Set errno to 0 before calling getpwuid/getgrgid, so that error

messages will be displayed only when there is, in fact, an error.
This commit is contained in:
Tim Kientzle 2004-05-17 18:29:12 +00:00
parent 5edb850fbe
commit a25502627d

View file

@ -1196,6 +1196,7 @@ lookup_uname_helper(struct bsdtar *bsdtar, const char **name, id_t id)
(void)bsdtar; /* UNUSED */
errno = 0;
pwent = getpwuid((uid_t)id);
if (pwent == NULL) {
*name = NULL;
@ -1222,6 +1223,7 @@ lookup_gname_helper(struct bsdtar *bsdtar, const char **name, id_t id)
(void)bsdtar; /* UNUSED */
errno = 0;
grent = getgrgid((gid_t)id);
if (grent == NULL && errno != 0) {
*name = NULL;