diff options
author | Matt Kraai <kraai@debian.org> | 2001-11-12 16:57:27 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-11-12 16:57:27 +0000 |
commit | c8227639db90c3147ef68f33c98e96b0ab6b01d6 (patch) | |
tree | b704ef3f684a41c7705b5e36dac2127d23d129c4 | |
parent | 357cfc739ed5f5c00ee46a43820a1d02367e3b38 (diff) | |
download | busybox-w32-c8227639db90c3147ef68f33c98e96b0ab6b01d6.tar.gz busybox-w32-c8227639db90c3147ef68f33c98e96b0ab6b01d6.tar.bz2 busybox-w32-c8227639db90c3147ef68f33c98e96b0ab6b01d6.zip |
Change strdup calls to xstrdup (patch from Steve Merrifield).
-rw-r--r-- | archival/bunzip2.c | 2 | ||||
-rw-r--r-- | archival/gunzip.c | 2 | ||||
-rw-r--r-- | editors/sed.c | 2 | ||||
-rw-r--r-- | editors/vi.c | 16 | ||||
-rw-r--r-- | modutils/insmod.c | 6 | ||||
-rw-r--r-- | shell/ash.c | 6 | ||||
-rw-r--r-- | shell/lash.c | 2 | ||||
-rw-r--r-- | sysklogd/syslogd.c | 4 | ||||
-rw-r--r-- | util-linux/mount.c | 4 |
9 files changed, 22 insertions, 22 deletions
diff --git a/archival/bunzip2.c b/archival/bunzip2.c index 757654dab..da9808e82 100644 --- a/archival/bunzip2.c +++ b/archival/bunzip2.c | |||
@@ -2324,7 +2324,7 @@ int bunzip2_main(int argc, char **argv) | |||
2324 | show_usage(); | 2324 | show_usage(); |
2325 | } | 2325 | } |
2326 | src_stream = xfopen(argv[1], "r"); | 2326 | src_stream = xfopen(argv[1], "r"); |
2327 | save_name = strdup(argv[1]); | 2327 | save_name = xstrdup(argv[1]); |
2328 | save_name_ptr = strrchr(save_name, '.'); | 2328 | save_name_ptr = strrchr(save_name, '.'); |
2329 | if (save_name_ptr == NULL) { | 2329 | if (save_name_ptr == NULL) { |
2330 | return(FALSE); | 2330 | return(FALSE); |
diff --git a/archival/gunzip.c b/archival/gunzip.c index 430bc630e..388672541 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
@@ -114,7 +114,7 @@ extern int gunzip_main(int argc, char **argv) | |||
114 | if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) { | 114 | if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) { |
115 | flags |= gunzip_to_stdout; | 115 | flags |= gunzip_to_stdout; |
116 | } else { | 116 | } else { |
117 | if_name = strdup(argv[optind]); | 117 | if_name = xstrdup(argv[optind]); |
118 | /* Open input file */ | 118 | /* Open input file */ |
119 | in_file = xfopen(if_name, "r"); | 119 | in_file = xfopen(if_name, "r"); |
120 | 120 | ||
diff --git a/editors/sed.c b/editors/sed.c index 3afa64e8f..66dfa1505 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -173,7 +173,7 @@ static int index_of_next_unescaped_regexp_delim(const struct sed_cmd * const sed | |||
173 | */ | 173 | */ |
174 | static int get_address(struct sed_cmd *sed_cmd, const char *str, int *linenum, regex_t **regex) | 174 | static int get_address(struct sed_cmd *sed_cmd, const char *str, int *linenum, regex_t **regex) |
175 | { | 175 | { |
176 | char *my_str = strdup(str); | 176 | char *my_str = xstrdup(str); |
177 | int idx = 0; | 177 | int idx = 0; |
178 | char olddelimiter; | 178 | char olddelimiter; |
179 | olddelimiter = sed_cmd->delimiter; | 179 | olddelimiter = sed_cmd->delimiter; |
diff --git a/editors/vi.c b/editors/vi.c index ddc2edc75..b65c9cf42 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | static const char vi_Version[] = | 21 | static const char vi_Version[] = |
22 | "$Id: vi.c,v 1.16 2001/10/24 04:59:23 andersen Exp $"; | 22 | "$Id: vi.c,v 1.17 2001/11/12 16:57:26 kraai Exp $"; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * To compile for standalone use: | 25 | * To compile for standalone use: |
@@ -385,7 +385,7 @@ extern int vi_main(int argc, char **argv) | |||
385 | editing = 1; // 0=exit, 1=one file, 2+ =many files | 385 | editing = 1; // 0=exit, 1=one file, 2+ =many files |
386 | if (cfn != 0) | 386 | if (cfn != 0) |
387 | free(cfn); | 387 | free(cfn); |
388 | cfn = (Byte *) strdup(argv[optind]); | 388 | cfn = (Byte *) xstrdup(argv[optind]); |
389 | edit_file(cfn); | 389 | edit_file(cfn); |
390 | } | 390 | } |
391 | } | 391 | } |
@@ -1085,7 +1085,7 @@ static void do_cmd(Byte c) | |||
1085 | // Stuff the last_modifying_cmd back into stdin | 1085 | // Stuff the last_modifying_cmd back into stdin |
1086 | // and let it be re-executed. | 1086 | // and let it be re-executed. |
1087 | if (last_modifying_cmd != 0) { | 1087 | if (last_modifying_cmd != 0) { |
1088 | ioq = ioq_start = (Byte *) strdup((char *) last_modifying_cmd); | 1088 | ioq = ioq_start = (Byte *) xstrdup((char *) last_modifying_cmd); |
1089 | } | 1089 | } |
1090 | break; | 1090 | break; |
1091 | #endif /* CONFIG_FEATURE_VI_DOT_CMD */ | 1091 | #endif /* CONFIG_FEATURE_VI_DOT_CMD */ |
@@ -1102,7 +1102,7 @@ static void do_cmd(Byte c) | |||
1102 | if (last_search_pattern != 0) { | 1102 | if (last_search_pattern != 0) { |
1103 | free(last_search_pattern); | 1103 | free(last_search_pattern); |
1104 | } | 1104 | } |
1105 | last_search_pattern = (Byte *) strdup((char *) q); | 1105 | last_search_pattern = (Byte *) xstrdup((char *) q); |
1106 | goto dc3; // now find the pattern | 1106 | goto dc3; // now find the pattern |
1107 | } | 1107 | } |
1108 | // user changed mind and erased the "/"- do nothing | 1108 | // 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 | |||
1655 | *q++ = *p; | 1655 | *q++ = *p; |
1656 | *q = '\0'; | 1656 | *q = '\0'; |
1657 | } | 1657 | } |
1658 | pat = (Byte *) strdup((char *) buf); // save copy of pattern | 1658 | pat = (Byte *) xstrdup((char *) buf); // save copy of pattern |
1659 | if (*p == '/') | 1659 | if (*p == '/') |
1660 | p++; | 1660 | p++; |
1661 | q = char_search(dot, pat, FORWARD, FULL); | 1661 | q = char_search(dot, pat, FORWARD, FULL); |
@@ -1852,7 +1852,7 @@ static void colon(Byte * buf) | |||
1852 | 1852 | ||
1853 | // There is a read-able regular file | 1853 | // There is a read-able regular file |
1854 | // make this the current file | 1854 | // make this the current file |
1855 | q = (Byte *) strdup((char *) fn); // save the cfn | 1855 | q = (Byte *) xstrdup((char *) fn); // save the cfn |
1856 | if (cfn != 0) | 1856 | if (cfn != 0) |
1857 | free(cfn); // free the old name | 1857 | free(cfn); // free the old name |
1858 | cfn = q; // remember new cfn | 1858 | cfn = q; // remember new cfn |
@@ -1905,7 +1905,7 @@ static void colon(Byte * buf) | |||
1905 | // user wants a new filename | 1905 | // user wants a new filename |
1906 | if (cfn != NULL) | 1906 | if (cfn != NULL) |
1907 | free(cfn); | 1907 | free(cfn); |
1908 | cfn = (Byte *) strdup((char *) args); | 1908 | cfn = (Byte *) xstrdup((char *) args); |
1909 | } else { | 1909 | } else { |
1910 | // user wants file status info | 1910 | // user wants file status info |
1911 | edit_status(); | 1911 | edit_status(); |
@@ -3465,7 +3465,7 @@ static Byte *get_input_line(Byte * prompt) // get input line- use "status line" | |||
3465 | refresh(FALSE); | 3465 | refresh(FALSE); |
3466 | if (obufp != NULL) | 3466 | if (obufp != NULL) |
3467 | free(obufp); | 3467 | free(obufp); |
3468 | obufp = (Byte *) strdup((char *) buf); | 3468 | obufp = (Byte *) xstrdup((char *) buf); |
3469 | return (obufp); | 3469 | return (obufp); |
3470 | } | 3470 | } |
3471 | 3471 | ||
diff --git a/modutils/insmod.c b/modutils/insmod.c index c21f22b74..8668aaa0f 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -133,7 +133,7 @@ | |||
133 | #ifndef MODUTILS_MODULE_H | 133 | #ifndef MODUTILS_MODULE_H |
134 | static const int MODUTILS_MODULE_H = 1; | 134 | static const int MODUTILS_MODULE_H = 1; |
135 | 135 | ||
136 | #ident "$Id: insmod.c,v 1.74 2001/10/24 04:59:54 andersen Exp $" | 136 | #ident "$Id: insmod.c,v 1.75 2001/11/12 16:57:26 kraai Exp $" |
137 | 137 | ||
138 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 138 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
139 | We do not use the kernel headers directly because we do not wish | 139 | We do not use the kernel headers directly because we do not wish |
@@ -350,7 +350,7 @@ int delete_module(const char *); | |||
350 | #ifndef MODUTILS_OBJ_H | 350 | #ifndef MODUTILS_OBJ_H |
351 | static const int MODUTILS_OBJ_H = 1; | 351 | static const int MODUTILS_OBJ_H = 1; |
352 | 352 | ||
353 | #ident "$Id: insmod.c,v 1.74 2001/10/24 04:59:54 andersen Exp $" | 353 | #ident "$Id: insmod.c,v 1.75 2001/11/12 16:57:26 kraai Exp $" |
354 | 354 | ||
355 | /* The relocatable object is manipulated using elfin types. */ | 355 | /* The relocatable object is manipulated using elfin types. */ |
356 | 356 | ||
@@ -724,7 +724,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf, | |||
724 | if (fullname[0] == '\0') | 724 | if (fullname[0] == '\0') |
725 | return (FALSE); | 725 | return (FALSE); |
726 | else { | 726 | else { |
727 | char *tmp, *tmp1 = strdup(filename); | 727 | char *tmp, *tmp1 = xstrdup(filename); |
728 | tmp = get_last_path_component(tmp1); | 728 | tmp = get_last_path_component(tmp1); |
729 | if (strcmp(tmp, fullname) == 0) { | 729 | if (strcmp(tmp, fullname) == 0) { |
730 | free(tmp1); | 730 | free(tmp1); |
diff --git a/shell/ash.c b/shell/ash.c index f218a88d5..c1603d790 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -12090,7 +12090,7 @@ initvar() { | |||
12090 | vpp = hashvar(ip->text); | 12090 | vpp = hashvar(ip->text); |
12091 | vp->next = *vpp; | 12091 | vp->next = *vpp; |
12092 | *vpp = vp; | 12092 | *vpp = vp; |
12093 | vp->text = strdup(ip->text); | 12093 | vp->text = xstrdup(ip->text); |
12094 | vp->flags = ip->flags; | 12094 | vp->flags = ip->flags; |
12095 | vp->func = ip->func; | 12095 | vp->func = ip->func; |
12096 | } | 12096 | } |
@@ -12102,7 +12102,7 @@ initvar() { | |||
12102 | vpp = hashvar("PS1="); | 12102 | vpp = hashvar("PS1="); |
12103 | vps1.next = *vpp; | 12103 | vps1.next = *vpp; |
12104 | *vpp = &vps1; | 12104 | *vpp = &vps1; |
12105 | vps1.text = strdup(geteuid() ? "PS1=$ " : "PS1=# "); | 12105 | vps1.text = xstrdup(geteuid() ? "PS1=$ " : "PS1=# "); |
12106 | vps1.flags = VSTRFIXED|VTEXTFIXED; | 12106 | vps1.flags = VSTRFIXED|VTEXTFIXED; |
12107 | } | 12107 | } |
12108 | } | 12108 | } |
@@ -12646,7 +12646,7 @@ findvar(struct var **vpp, const char *name) | |||
12646 | /* | 12646 | /* |
12647 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> | 12647 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> |
12648 | * This file contains code for the times builtin. | 12648 | * This file contains code for the times builtin. |
12649 | * $Id: ash.c,v 1.35 2001/11/12 16:44:55 kraai Exp $ | 12649 | * $Id: ash.c,v 1.36 2001/11/12 16:57:26 kraai Exp $ |
12650 | */ | 12650 | */ |
12651 | static int timescmd (int argc, char **argv) | 12651 | static int timescmd (int argc, char **argv) |
12652 | { | 12652 | { |
diff --git a/shell/lash.c b/shell/lash.c index 5b9d0a6b3..79fd433e3 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -820,7 +820,7 @@ static int expand_arguments(char *command) | |||
820 | 820 | ||
821 | /* We need a clean copy, so strsep can mess up the copy while | 821 | /* We need a clean copy, so strsep can mess up the copy while |
822 | * we write stuff into the original (in a minute) */ | 822 | * we write stuff into the original (in a minute) */ |
823 | cmd = cmd_copy = strdup(command); | 823 | cmd = cmd_copy = xstrdup(command); |
824 | *command = '\0'; | 824 | *command = '\0'; |
825 | for (ix = 0, tmpcmd = cmd; | 825 | for (ix = 0, tmpcmd = cmd; |
826 | (tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) { | 826 | (tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) { |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 84414439e..625f99715 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -589,11 +589,11 @@ extern int syslogd_main(int argc, char **argv) | |||
589 | doFork = FALSE; | 589 | doFork = FALSE; |
590 | break; | 590 | break; |
591 | case 'O': | 591 | case 'O': |
592 | logFilePath = strdup(optarg); | 592 | logFilePath = xstrdup(optarg); |
593 | break; | 593 | break; |
594 | #ifdef CONFIG_FEATURE_REMOTE_LOG | 594 | #ifdef CONFIG_FEATURE_REMOTE_LOG |
595 | case 'R': | 595 | case 'R': |
596 | RemoteHost = strdup(optarg); | 596 | RemoteHost = xstrdup(optarg); |
597 | if ( (p = strchr(RemoteHost, ':'))){ | 597 | if ( (p = strchr(RemoteHost, ':'))){ |
598 | RemotePort = atoi(p+1); | 598 | RemotePort = atoi(p+1); |
599 | *p = '\0'; | 599 | *p = '\0'; |
diff --git a/util-linux/mount.c b/util-linux/mount.c index bfa9a3040..e26d4db7a 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -463,9 +463,9 @@ extern int mount_main(int argc, char **argv) | |||
463 | 463 | ||
464 | strcpy(device, m->mnt_fsname); | 464 | strcpy(device, m->mnt_fsname); |
465 | strcpy(directory, m->mnt_dir); | 465 | strcpy(directory, m->mnt_dir); |
466 | filesystemType = strdup(m->mnt_type); | 466 | filesystemType = xstrdup(m->mnt_type); |
467 | singlemount: | 467 | singlemount: |
468 | string_flags = strdup(string_flags); | 468 | string_flags = xstrdup(string_flags); |
469 | rc = EXIT_SUCCESS; | 469 | rc = EXIT_SUCCESS; |
470 | #ifdef CONFIG_NFSMOUNT | 470 | #ifdef CONFIG_NFSMOUNT |
471 | if (strchr(device, ':') != NULL) | 471 | if (strchr(device, ':') != NULL) |