Dolda2000 GitWeb
/
doldaconnect.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Create a new session keyring with keyutils.
[doldaconnect.git]
/
daemon
/
utils.c
diff --git
a/daemon/utils.c
b/daemon/utils.c
index
1175970
..
d084db6
100644
(file)
--- a/
daemon/utils.c
+++ b/
daemon/utils.c
@@
-190,7
+190,7
@@
wchar_t *icsmbstowcs(char *mbs, char *charset, wchar_t *def)
free(buf);
if((buf = icmbstowcs(mbs, charset)) == NULL)
{
free(buf);
if((buf = icmbstowcs(mbs, charset)) == NULL)
{
- if(
*def == '~'
)
+ if(
(def != NULL) && (*def == L'~')
)
{
flog(LOG_WARNING, "icsmbstowcs: could not convert wcs string into charset %s: %s", charset, strerror(errno));
def++;
{
flog(LOG_WARNING, "icsmbstowcs: could not convert wcs string into charset %s: %s", charset, strerror(errno));
def++;
@@
-264,7
+264,7
@@
char *icswcstombs(wchar_t *wcs, char *charset, char *def)
free(buf);
if((buf = icwcstombs(wcs, charset)) == NULL)
{
free(buf);
if((buf = icwcstombs(wcs, charset)) == NULL)
{
- if(
*def == '~'
)
+ if(
(def != NULL) && (*def == '~')
)
{
flog(LOG_WARNING, "icswcstombs: could not convert mbs string from charset %s: %s", charset, strerror(errno));
def++;
{
flog(LOG_WARNING, "icswcstombs: could not convert mbs string from charset %s: %s", charset, strerror(errno));
def++;
@@
-768,12
+768,27
@@
struct wcspair *newwcspair(wchar_t *key, wchar_t *val, struct wcspair **list)
void freewcspair(struct wcspair *pair, struct wcspair **list)
{
void freewcspair(struct wcspair *pair, struct wcspair **list)
{
- if(list != NULL)
+ struct wcspair *cur;
+
+ for(cur = *list; cur != NULL; list = &(cur->next), cur = cur->next)
{
{
- if(*list == pair)
- *list = pair->next;
+ if(cur == pair)
+ {
+ *list = cur->next;
+ break;
+ }
}
free(pair->key);
free(pair->val);
free(pair);
}
}
free(pair->key);
free(pair->val);
free(pair);
}
+
+wchar_t *wpfind(struct wcspair *list, wchar_t *key)
+{
+ for(; list != NULL; list = list->next)
+ {
+ if(!wcscmp(list->key, key))
+ return(list->val);
+ }
+ return(NULL);
+}