Rename xmalloc, xmemdup, xstrdup to smb_$1 to avoid conflicts with the
authorMartin Pool <mbp@samba.org>
Tue, 20 Nov 2001 06:38:09 +0000 (06:38 +0000)
committerMartin Pool <mbp@samba.org>
Tue, 20 Nov 2001 06:38:09 +0000 (06:38 +0000)
versions defined by libreadline on SCO (!).
(This used to be commit 32480d7aff21ce1c14991e242aaf8a4e14ec6f2a)

source3/client/smbmount.c
source3/lib/util.c
source3/utils/smbpasswd.c

index d3265ee606dbf8a4ac025374c71c503e99d1c0a6..f8fc0558cebfa15b33231898aeb55f2d8c0c20b4 100644 (file)
@@ -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";
index ea39d8a05b2f2bda9fbfa87917f752a857d43288..dc948a406b3516f3394d5b5a664e57228041f734 100644 (file)
@@ -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;
 }
index ea8fffc2951d6e09f4642f845bc356a9c12e2ce3..b60f919e79045036d5bf0cc6ece31abe4a10e374 100644 (file)
@@ -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);
                }
        }