1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Rename xmalloc, xmemdup, xstrdup to smb_$1 to avoid conflicts with the

versions defined by libreadline on SCO (!).
This commit is contained in:
Martin Pool 0001-01-01 00:00:00 +00:00
parent 309b718842
commit 32480d7aff
3 changed files with 28 additions and 27 deletions

View 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";

View 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)
/**
malloc that aborts with smb_panic on fail or zero 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;
}

View 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);
}
}