Replace strdup with xstrdup

This commit is contained in:
Sergey Poznyakoff
2005-02-15 15:24:35 +00:00
parent e7e66c4426
commit 549a691ada
3 changed files with 8 additions and 8 deletions

View File

@@ -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;

View File

@@ -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. */

View File

@@ -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;