Change strdup calls to xstrdup (patch from Steve Merrifield).
This commit is contained in:
parent
357cfc739e
commit
c8227639db
@ -2324,7 +2324,7 @@ int bunzip2_main(int argc, char **argv)
|
|||||||
show_usage();
|
show_usage();
|
||||||
}
|
}
|
||||||
src_stream = xfopen(argv[1], "r");
|
src_stream = xfopen(argv[1], "r");
|
||||||
save_name = strdup(argv[1]);
|
save_name = xstrdup(argv[1]);
|
||||||
save_name_ptr = strrchr(save_name, '.');
|
save_name_ptr = strrchr(save_name, '.');
|
||||||
if (save_name_ptr == NULL) {
|
if (save_name_ptr == NULL) {
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
@ -114,7 +114,7 @@ extern int gunzip_main(int argc, char **argv)
|
|||||||
if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) {
|
if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) {
|
||||||
flags |= gunzip_to_stdout;
|
flags |= gunzip_to_stdout;
|
||||||
} else {
|
} else {
|
||||||
if_name = strdup(argv[optind]);
|
if_name = xstrdup(argv[optind]);
|
||||||
/* Open input file */
|
/* Open input file */
|
||||||
in_file = xfopen(if_name, "r");
|
in_file = xfopen(if_name, "r");
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ static int index_of_next_unescaped_regexp_delim(const struct sed_cmd * const sed
|
|||||||
*/
|
*/
|
||||||
static int get_address(struct sed_cmd *sed_cmd, const char *str, int *linenum, regex_t **regex)
|
static int get_address(struct sed_cmd *sed_cmd, const char *str, int *linenum, regex_t **regex)
|
||||||
{
|
{
|
||||||
char *my_str = strdup(str);
|
char *my_str = xstrdup(str);
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
char olddelimiter;
|
char olddelimiter;
|
||||||
olddelimiter = sed_cmd->delimiter;
|
olddelimiter = sed_cmd->delimiter;
|
||||||
|
16
editors/vi.c
16
editors/vi.c
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static const char vi_Version[] =
|
static const char vi_Version[] =
|
||||||
"$Id: vi.c,v 1.16 2001/10/24 04:59:23 andersen Exp $";
|
"$Id: vi.c,v 1.17 2001/11/12 16:57:26 kraai Exp $";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To compile for standalone use:
|
* To compile for standalone use:
|
||||||
@ -385,7 +385,7 @@ extern int vi_main(int argc, char **argv)
|
|||||||
editing = 1; // 0=exit, 1=one file, 2+ =many files
|
editing = 1; // 0=exit, 1=one file, 2+ =many files
|
||||||
if (cfn != 0)
|
if (cfn != 0)
|
||||||
free(cfn);
|
free(cfn);
|
||||||
cfn = (Byte *) strdup(argv[optind]);
|
cfn = (Byte *) xstrdup(argv[optind]);
|
||||||
edit_file(cfn);
|
edit_file(cfn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1085,7 +1085,7 @@ static void do_cmd(Byte c)
|
|||||||
// Stuff the last_modifying_cmd back into stdin
|
// Stuff the last_modifying_cmd back into stdin
|
||||||
// and let it be re-executed.
|
// and let it be re-executed.
|
||||||
if (last_modifying_cmd != 0) {
|
if (last_modifying_cmd != 0) {
|
||||||
ioq = ioq_start = (Byte *) strdup((char *) last_modifying_cmd);
|
ioq = ioq_start = (Byte *) xstrdup((char *) last_modifying_cmd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_FEATURE_VI_DOT_CMD */
|
#endif /* CONFIG_FEATURE_VI_DOT_CMD */
|
||||||
@ -1102,7 +1102,7 @@ static void do_cmd(Byte c)
|
|||||||
if (last_search_pattern != 0) {
|
if (last_search_pattern != 0) {
|
||||||
free(last_search_pattern);
|
free(last_search_pattern);
|
||||||
}
|
}
|
||||||
last_search_pattern = (Byte *) strdup((char *) q);
|
last_search_pattern = (Byte *) xstrdup((char *) q);
|
||||||
goto dc3; // now find the pattern
|
goto dc3; // now find the pattern
|
||||||
}
|
}
|
||||||
// user changed mind and erased the "/"- do nothing
|
// user changed mind and erased the "/"- do nothing
|
||||||
@ -1655,7 +1655,7 @@ static Byte *get_one_address(Byte * p, int *addr) // get colon addr, if present
|
|||||||
*q++ = *p;
|
*q++ = *p;
|
||||||
*q = '\0';
|
*q = '\0';
|
||||||
}
|
}
|
||||||
pat = (Byte *) strdup((char *) buf); // save copy of pattern
|
pat = (Byte *) xstrdup((char *) buf); // save copy of pattern
|
||||||
if (*p == '/')
|
if (*p == '/')
|
||||||
p++;
|
p++;
|
||||||
q = char_search(dot, pat, FORWARD, FULL);
|
q = char_search(dot, pat, FORWARD, FULL);
|
||||||
@ -1852,7 +1852,7 @@ static void colon(Byte * buf)
|
|||||||
|
|
||||||
// There is a read-able regular file
|
// There is a read-able regular file
|
||||||
// make this the current file
|
// make this the current file
|
||||||
q = (Byte *) strdup((char *) fn); // save the cfn
|
q = (Byte *) xstrdup((char *) fn); // save the cfn
|
||||||
if (cfn != 0)
|
if (cfn != 0)
|
||||||
free(cfn); // free the old name
|
free(cfn); // free the old name
|
||||||
cfn = q; // remember new cfn
|
cfn = q; // remember new cfn
|
||||||
@ -1905,7 +1905,7 @@ static void colon(Byte * buf)
|
|||||||
// user wants a new filename
|
// user wants a new filename
|
||||||
if (cfn != NULL)
|
if (cfn != NULL)
|
||||||
free(cfn);
|
free(cfn);
|
||||||
cfn = (Byte *) strdup((char *) args);
|
cfn = (Byte *) xstrdup((char *) args);
|
||||||
} else {
|
} else {
|
||||||
// user wants file status info
|
// user wants file status info
|
||||||
edit_status();
|
edit_status();
|
||||||
@ -3465,7 +3465,7 @@ static Byte *get_input_line(Byte * prompt) // get input line- use "status line"
|
|||||||
refresh(FALSE);
|
refresh(FALSE);
|
||||||
if (obufp != NULL)
|
if (obufp != NULL)
|
||||||
free(obufp);
|
free(obufp);
|
||||||
obufp = (Byte *) strdup((char *) buf);
|
obufp = (Byte *) xstrdup((char *) buf);
|
||||||
return (obufp);
|
return (obufp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@
|
|||||||
#ifndef MODUTILS_MODULE_H
|
#ifndef MODUTILS_MODULE_H
|
||||||
static const int MODUTILS_MODULE_H = 1;
|
static const int MODUTILS_MODULE_H = 1;
|
||||||
|
|
||||||
#ident "$Id: insmod.c,v 1.74 2001/10/24 04:59:54 andersen Exp $"
|
#ident "$Id: insmod.c,v 1.75 2001/11/12 16:57:26 kraai Exp $"
|
||||||
|
|
||||||
/* This file contains the structures used by the 2.0 and 2.1 kernels.
|
/* This file contains the structures used by the 2.0 and 2.1 kernels.
|
||||||
We do not use the kernel headers directly because we do not wish
|
We do not use the kernel headers directly because we do not wish
|
||||||
@ -350,7 +350,7 @@ int delete_module(const char *);
|
|||||||
#ifndef MODUTILS_OBJ_H
|
#ifndef MODUTILS_OBJ_H
|
||||||
static const int MODUTILS_OBJ_H = 1;
|
static const int MODUTILS_OBJ_H = 1;
|
||||||
|
|
||||||
#ident "$Id: insmod.c,v 1.74 2001/10/24 04:59:54 andersen Exp $"
|
#ident "$Id: insmod.c,v 1.75 2001/11/12 16:57:26 kraai Exp $"
|
||||||
|
|
||||||
/* The relocatable object is manipulated using elfin types. */
|
/* The relocatable object is manipulated using elfin types. */
|
||||||
|
|
||||||
@ -724,7 +724,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
|
|||||||
if (fullname[0] == '\0')
|
if (fullname[0] == '\0')
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
else {
|
else {
|
||||||
char *tmp, *tmp1 = strdup(filename);
|
char *tmp, *tmp1 = xstrdup(filename);
|
||||||
tmp = get_last_path_component(tmp1);
|
tmp = get_last_path_component(tmp1);
|
||||||
if (strcmp(tmp, fullname) == 0) {
|
if (strcmp(tmp, fullname) == 0) {
|
||||||
free(tmp1);
|
free(tmp1);
|
||||||
|
@ -12090,7 +12090,7 @@ initvar() {
|
|||||||
vpp = hashvar(ip->text);
|
vpp = hashvar(ip->text);
|
||||||
vp->next = *vpp;
|
vp->next = *vpp;
|
||||||
*vpp = vp;
|
*vpp = vp;
|
||||||
vp->text = strdup(ip->text);
|
vp->text = xstrdup(ip->text);
|
||||||
vp->flags = ip->flags;
|
vp->flags = ip->flags;
|
||||||
vp->func = ip->func;
|
vp->func = ip->func;
|
||||||
}
|
}
|
||||||
@ -12102,7 +12102,7 @@ initvar() {
|
|||||||
vpp = hashvar("PS1=");
|
vpp = hashvar("PS1=");
|
||||||
vps1.next = *vpp;
|
vps1.next = *vpp;
|
||||||
*vpp = &vps1;
|
*vpp = &vps1;
|
||||||
vps1.text = strdup(geteuid() ? "PS1=$ " : "PS1=# ");
|
vps1.text = xstrdup(geteuid() ? "PS1=$ " : "PS1=# ");
|
||||||
vps1.flags = VSTRFIXED|VTEXTFIXED;
|
vps1.flags = VSTRFIXED|VTEXTFIXED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12646,7 +12646,7 @@ findvar(struct var **vpp, const char *name)
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
|
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
|
||||||
* This file contains code for the times builtin.
|
* This file contains code for the times builtin.
|
||||||
* $Id: ash.c,v 1.35 2001/11/12 16:44:55 kraai Exp $
|
* $Id: ash.c,v 1.36 2001/11/12 16:57:26 kraai Exp $
|
||||||
*/
|
*/
|
||||||
static int timescmd (int argc, char **argv)
|
static int timescmd (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -820,7 +820,7 @@ static int expand_arguments(char *command)
|
|||||||
|
|
||||||
/* We need a clean copy, so strsep can mess up the copy while
|
/* We need a clean copy, so strsep can mess up the copy while
|
||||||
* we write stuff into the original (in a minute) */
|
* we write stuff into the original (in a minute) */
|
||||||
cmd = cmd_copy = strdup(command);
|
cmd = cmd_copy = xstrdup(command);
|
||||||
*command = '\0';
|
*command = '\0';
|
||||||
for (ix = 0, tmpcmd = cmd;
|
for (ix = 0, tmpcmd = cmd;
|
||||||
(tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) {
|
(tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) {
|
||||||
|
@ -589,11 +589,11 @@ extern int syslogd_main(int argc, char **argv)
|
|||||||
doFork = FALSE;
|
doFork = FALSE;
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
logFilePath = strdup(optarg);
|
logFilePath = xstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_FEATURE_REMOTE_LOG
|
#ifdef CONFIG_FEATURE_REMOTE_LOG
|
||||||
case 'R':
|
case 'R':
|
||||||
RemoteHost = strdup(optarg);
|
RemoteHost = xstrdup(optarg);
|
||||||
if ( (p = strchr(RemoteHost, ':'))){
|
if ( (p = strchr(RemoteHost, ':'))){
|
||||||
RemotePort = atoi(p+1);
|
RemotePort = atoi(p+1);
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
@ -463,9 +463,9 @@ extern int mount_main(int argc, char **argv)
|
|||||||
|
|
||||||
strcpy(device, m->mnt_fsname);
|
strcpy(device, m->mnt_fsname);
|
||||||
strcpy(directory, m->mnt_dir);
|
strcpy(directory, m->mnt_dir);
|
||||||
filesystemType = strdup(m->mnt_type);
|
filesystemType = xstrdup(m->mnt_type);
|
||||||
singlemount:
|
singlemount:
|
||||||
string_flags = strdup(string_flags);
|
string_flags = xstrdup(string_flags);
|
||||||
rc = EXIT_SUCCESS;
|
rc = EXIT_SUCCESS;
|
||||||
#ifdef CONFIG_NFSMOUNT
|
#ifdef CONFIG_NFSMOUNT
|
||||||
if (strchr(device, ':') != NULL)
|
if (strchr(device, ':') != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user