Skip to content

Commit

Permalink
libtar: Remove now-unused th_get_uid and th_get_gid
Browse files Browse the repository at this point in the history
These remove the last problematic getxxnam() calls in libtar
  • Loading branch information
JonathonReinhart committed Aug 7, 2022
1 parent 9ef7901 commit 6fcecfa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
34 changes: 0 additions & 34 deletions libtar/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

#include <stdio.h>
#include <sys/param.h>
#include <pwd.h>
#include <grp.h>
#include <string.h>
#include "libtar.h"

Expand All @@ -40,38 +38,6 @@ th_get_pathname(const TAR *t)
}


uid_t
th_get_uid(const TAR *t)
{
int uid;
struct passwd *pw;

pw = getpwnam(t->th_buf.uname);
if (pw != NULL)
return pw->pw_uid;

/* if the password entry doesn't exist */
sscanf(t->th_buf.uid, "%o", &uid);
return uid;
}


gid_t
th_get_gid(const TAR *t)
{
int gid;
struct group *gr;

gr = getgrnam(t->th_buf.gname);
if (gr != NULL)
return gr->gr_gid;

/* if the group entry doesn't exist */
sscanf(t->th_buf.gid, "%o", &gid);
return gid;
}


mode_t
th_get_mode(const TAR *t)
{
Expand Down
2 changes: 0 additions & 2 deletions libtar/libtar.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ int th_read(TAR *t);
: (t)->th_buf.linkname)
const char *th_get_pathname(const TAR *t);
mode_t th_get_mode(const TAR *t);
uid_t th_get_uid(const TAR *t);
gid_t th_get_gid(const TAR *t);


/***** extract.c ***********************************************************/
Expand Down

0 comments on commit 6fcecfa

Please sign in to comment.