diff options
-rw-r--r-- | source3/client/smbmount.c | 8 | ||||
-rw-r--r-- | source3/lib/util.c | 29 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 16 |
3 files changed, 27 insertions, 26 deletions
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index d3265ee606..f8fc0558ce 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -452,22 +452,22 @@ static void init_mount(void) if (mount_uid) { slprintf(tmp, sizeof(tmp)-1, "%d", mount_uid); args[i++] = "-u"; - args[i++] = xstrdup(tmp); + args[i++] = smb_xstrdup(tmp); } if (mount_gid) { slprintf(tmp, sizeof(tmp)-1, "%d", mount_gid); args[i++] = "-g"; - args[i++] = xstrdup(tmp); + args[i++] = smb_xstrdup(tmp); } if (mount_fmask) { slprintf(tmp, sizeof(tmp)-1, "0%o", mount_fmask); args[i++] = "-f"; - args[i++] = xstrdup(tmp); + args[i++] = smb_xstrdup(tmp); } if (mount_dmask) { slprintf(tmp, sizeof(tmp)-1, "0%o", mount_dmask); args[i++] = "-d"; - args[i++] = xstrdup(tmp); + args[i++] = smb_xstrdup(tmp); } if (options) { args[i++] = "-o"; diff --git a/source3/lib/util.c b/source3/lib/util.c index ea39d8a05b..dc948a406b 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1698,41 +1698,42 @@ int smb_mkstemp(char *template) #endif } -/***************************************************************** + +/** malloc that aborts with smb_panic on fail or zero size. - *****************************************************************/ +**/ -void *xmalloc(size_t size) +void *smb_xmalloc(size_t size) { void *p; if (size == 0) - smb_panic("xmalloc: called with zero size.\n"); + smb_panic("smb_xmalloc: called with zero size.\n"); if ((p = malloc(size)) == NULL) - smb_panic("xmalloc: malloc fail.\n"); + smb_panic("smb_xmalloc: malloc fail.\n"); return p; } -/***************************************************************** +/** Memdup with smb_panic on fail. - *****************************************************************/ +**/ -void *xmemdup(const void *p, size_t size) +void *smb_xmemdup(const void *p, size_t size) { void *p2; - p2 = xmalloc(size); + p2 = smb_xmalloc(size); memcpy(p2, p, size); return p2; } -/***************************************************************** +/** strdup that aborts on malloc fail. - *****************************************************************/ +**/ -char *xstrdup(const char *s) +char *smb_xstrdup(const char *s) { char *s1 = strdup(s); if (!s1) - smb_panic("xstrdup: malloc fail\n"); + smb_panic("smb_xstrdup: malloc fail\n"); return s1; } @@ -2021,7 +2022,7 @@ DATA_BLOB data_blob(const void *p, size_t length) return ret; } - ret.data = xmemdup(p, length); + ret.data = smb_xmemdup(p, length); ret.length = length; return ret; } diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index ea8fffc295..b60f919e79 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -458,7 +458,7 @@ static char *get_pass( char *prompt, BOOL stdin_get) } else { p = getpass(prompt); } - return xstrdup(p); + return smb_xstrdup(p); } /************************************************************* @@ -685,7 +685,7 @@ static int process_root(int argc, char *argv[]) if (got_username || got_pass) usage(); fstrcpy(user_name, argv[0]); - new_passwd = xstrdup(argv[1]); + new_passwd = smb_xstrdup(argv[1]); break; default: usage(); @@ -715,7 +715,7 @@ static int process_root(int argc, char *argv[]) if (local_flags & LOCAL_ADD_USER) { SAFE_FREE(new_passwd); - new_passwd = xstrdup(user_name); + new_passwd = smb_xstrdup(user_name); strlower(new_passwd); } @@ -793,9 +793,9 @@ static int process_root(int argc, char *argv[]) } -/************************************************************* -handle password changing for non-root -*************************************************************/ +/** + handle password changing for non-root +**/ static int process_nonroot(int argc, char *argv[]) { struct passwd *pwd = NULL; @@ -842,9 +842,9 @@ static int process_nonroot(int argc, char *argv[]) if (!user_name) { pwd = sys_getpwuid(getuid()); if (pwd) { - user_name = xstrdup(pwd->pw_name); + user_name = smb_xstrdup(pwd->pw_name); } else { - fprintf(stderr,"you don't exist - go away\n"); + fprintf(stderr, "smbpasswd: you don't exist - go away\n"); exit(1); } } |