diff options
author | Jeremy Allison <jra@samba.org> | 1999-12-22 18:46:05 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1999-12-22 18:46:05 +0000 |
commit | ca64f4ab00c6d54022ba9bd4b869523566a242d7 (patch) | |
tree | a37d1fe70e3f21bb20b1fc0b16e1619cb2b5e681 /source/lib | |
parent | f4ecc5a8e39ee69c59123b7b3ffbd081f69824ca (diff) | |
download | samba-ca64f4ab00c6d54022ba9bd4b869523566a242d7.tar.gz samba-ca64f4ab00c6d54022ba9bd4b869523566a242d7.tar.xz samba-ca64f4ab00c6d54022ba9bd4b869523566a242d7.zip |
include/includes.h: Trimmed down unicode directory entry to be POSIX complient.
lib/system.c: Trimmed down unicode directory entry to be POSIX complient.
lib/util_unistr.c: Added wstrdup().
Jeremy.
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/system.c | 7 | ||||
-rw-r--r-- | source/lib/util_unistr.c | 14 |
2 files changed, 18 insertions, 3 deletions
diff --git a/source/lib/system.c b/source/lib/system.c index 710f30bac8b..d1467499747 100644 --- a/source/lib/system.c +++ b/source/lib/system.c @@ -802,10 +802,11 @@ SMB_STRUCT_WDIRENT *wsys_readdir(DIR *dirp) if(!dirval) return NULL; - retval.d_ino = (SMB_INO_T)dirval->d_ino; - retval.d_off = (SMB_OFF_T)dirval->d_off; + /* + * The only POSIX defined member of this struct is d_name. + */ + unix_to_unicode(retval.d_name,dirval->d_name,sizeof(retval.d_name)); - retval.d_reclen = wstrlen(retval.d_name); return &retval; } diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c index 00f6ba48973..cdeaefce7a3 100644 --- a/source/lib/util_unistr.c +++ b/source/lib/util_unistr.c @@ -891,3 +891,17 @@ smb_ucs2_t *wstrtok(smb_ucs2_t *s1, const smb_ucs2_t *s2) return NULL; } + +/******************************************************************* + Duplicate a ucs2 string. +********************************************************************/ + +smb_ucs2_t *wstrdup(const smb_ucs2_t *s) +{ + size_t newlen = (wstrlen(s)*sizeof(smb_ucs2_t)) + 1; + smb_ucs2_t *newstr = (smb_ucs2_t *)malloc(newlen); + if (newstr == NULL) + return NULL; + safe_wstrcpy(newstr, s, newlen); + return newstr; +} |