summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1999-12-22 18:46:05 +0000
committerJeremy Allison <jra@samba.org>1999-12-22 18:46:05 +0000
commit5b3096a32fff88cb5f5388402f327da7b3d3dc18 (patch)
treef716661617d477af0b427dadf474510e0db724e2 /source3
parentfc4e722127c13b9b3e135ce3813f339eea28b8a5 (diff)
downloadsamba-5b3096a32fff88cb5f5388402f327da7b3d3dc18.tar.gz
samba-5b3096a32fff88cb5f5388402f327da7b3d3dc18.tar.bz2
samba-5b3096a32fff88cb5f5388402f327da7b3d3dc18.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. (This used to be commit ca64f4ab00c6d54022ba9bd4b869523566a242d7)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/includes.h4
-rw-r--r--source3/lib/system.c7
-rw-r--r--source3/lib/util_unistr.c14
3 files changed, 19 insertions, 6 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h
index b42f5e0115..0e8505daec 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -651,12 +651,10 @@ extern int errno;
/*
* Type for wide character dirent structure.
+ * Only d_name is defined by POSIX.
*/
typedef struct smb_wdirent {
- SMB_INO_T d_ino;
- SMB_OFF_T d_off;
- unsigned short d_reclen;
wpstring d_name;
} SMB_STRUCT_WDIRENT;
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 710f30bac8..d146749974 100644
--- a/source3/lib/system.c
+++ b/source3/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/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 00f6ba4897..cdeaefce7a 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/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;
+}