From: Sergey Poznyakoff Date: Tue, 15 Feb 2005 15:24:35 +0000 (+0000) Subject: Replace strdup with xstrdup X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=549a691adaac37bde0bcf7d91cbe353733aac843;p=chaz%2Ftar Replace strdup with xstrdup --- diff --git a/src/create.c b/src/create.c index d4a1b09..6108c43 100644 --- a/src/create.c +++ b/src/create.c @@ -1078,7 +1078,7 @@ dump_dir0 (char *directory, { char const *entry; size_t entry_len; - char *name_buf = strdup (st->orig_file_name); + char *name_buf = xstrdup (st->orig_file_name); size_t name_size = strlen (name_buf); size_t name_len = name_size; diff --git a/src/names.c b/src/names.c index c4c94de..5f3b18b 100644 --- a/src/names.c +++ b/src/names.c @@ -66,7 +66,7 @@ uid_to_uname (uid_t uid, char **uname) if (uid != 0 && uid == cached_no_such_uid) { - *uname = strdup (""); + *uname = xstrdup (""); return; } @@ -81,11 +81,11 @@ uid_to_uname (uid_t uid, char **uname) else { cached_no_such_uid = uid; - *uname = strdup (""); + *uname = xstrdup (""); return; } } - *uname = strdup (cached_uname); + *uname = xstrdup (cached_uname); } /* Given GID, find the corresponding GNAME. */ @@ -96,7 +96,7 @@ gid_to_gname (gid_t gid, char **gname) if (gid != 0 && gid == cached_no_such_gid) { - *gname = strdup (""); + *gname = xstrdup (""); return; } @@ -111,11 +111,11 @@ gid_to_gname (gid_t gid, char **gname) else { cached_no_such_gid = gid; - *gname = strdup (""); + *gname = xstrdup (""); return; } } - *gname = strdup (cached_gname); + *gname = xstrdup (cached_gname); } /* Given UNAME, set the corresponding UID and return 1, or else, return 0. */ diff --git a/src/tar.c b/src/tar.c index 1536eed..1b0bf8f 100644 --- a/src/tar.c +++ b/src/tar.c @@ -1401,7 +1401,7 @@ parse_opt (int key, char *arg, struct argp_state *state) xrealloc (archive_name_array, sizeof (const char *) * allocated_archive_names); } - archive_name_array[archive_names++] = strdup (buf); + archive_name_array[archive_names++] = xstrdup (buf); } break;