summaryrefslogtreecommitdiffstats
path: root/bin/pax/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pax/cache.c')
-rw-r--r--bin/pax/cache.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/bin/pax/cache.c b/bin/pax/cache.c
index 7f3b37f..040e18b 100644
--- a/bin/pax/cache.c
+++ b/bin/pax/cache.c
@@ -76,7 +76,7 @@ static GIDC **grptb = NULL; /* group name to gid cache */
* 0 if ok, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
int
uidtb_start(void)
#else
@@ -92,7 +92,7 @@ uidtb_start()
return(-1);
if ((uidtb = (UIDC **)calloc(UID_SZ, sizeof(UIDC *))) == NULL) {
++fail;
- pax_warn(1, "Unable to allocate memory for user id cache table");
+ paxwarn(1, "Unable to allocate memory for user id cache table");
return(-1);
}
return(0);
@@ -105,7 +105,7 @@ uidtb_start()
* 0 if ok, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
int
gidtb_start(void)
#else
@@ -121,7 +121,7 @@ gidtb_start()
return(-1);
if ((gidtb = (GIDC **)calloc(GID_SZ, sizeof(GIDC *))) == NULL) {
++fail;
- pax_warn(1, "Unable to allocate memory for group id cache table");
+ paxwarn(1, "Unable to allocate memory for group id cache table");
return(-1);
}
return(0);
@@ -134,7 +134,7 @@ gidtb_start()
* 0 if ok, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
int
usrtb_start(void)
#else
@@ -150,7 +150,7 @@ usrtb_start()
return(-1);
if ((usrtb = (UIDC **)calloc(UNM_SZ, sizeof(UIDC *))) == NULL) {
++fail;
- pax_warn(1, "Unable to allocate memory for user name cache table");
+ paxwarn(1, "Unable to allocate memory for user name cache table");
return(-1);
}
return(0);
@@ -163,7 +163,7 @@ usrtb_start()
* 0 if ok, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
int
grptb_start(void)
#else
@@ -179,7 +179,7 @@ grptb_start()
return(-1);
if ((grptb = (GIDC **)calloc(GNM_SZ, sizeof(GIDC *))) == NULL) {
++fail;
- pax_warn(1,"Unable to allocate memory for group name cache table");
+ paxwarn(1,"Unable to allocate memory for group name cache table");
return(-1);
}
return(0);
@@ -193,7 +193,7 @@ grptb_start()
* Pointer to stored name (or a empty string)
*/
-#if __STDC__
+#ifdef __STDC__
char *
name_uid(uid_t uid, int frc)
#else
@@ -242,9 +242,10 @@ name_uid(uid, frc)
ptr->uid = uid;
ptr->valid = INVALID;
# ifdef NET2_STAT
- (void)sprintf(ptr->name, "%u", uid);
+ (void)snprintf(ptr->name, sizeof(ptr->name), "%u", uid);
# else
- (void)sprintf(ptr->name, "%lu", (u_long)uid);
+ (void)snprintf(ptr->name, sizeof(ptr->name), "%lu",
+ (unsigned long)uid);
# endif
if (frc == 0)
return("");
@@ -270,7 +271,7 @@ name_uid(uid, frc)
* Pointer to stored name (or a empty string)
*/
-#if __STDC__
+#ifdef __STDC__
char *
name_gid(gid_t gid, int frc)
#else
@@ -319,9 +320,10 @@ name_gid(gid, frc)
ptr->gid = gid;
ptr->valid = INVALID;
# ifdef NET2_STAT
- (void)sprintf(ptr->name, "%u", gid);
+ (void)snprintf(ptr->name, sizeof(ptr->name), "%u", gid);
# else
- (void)sprintf(ptr->name, "%lu", (u_long)gid);
+ (void)snprintf(ptr->name, sizeof(ptr->name), "%lu",
+ (unsigned long)gid);
# endif
if (frc == 0)
return("");
@@ -346,7 +348,7 @@ name_gid(gid, frc)
* the uid (if any) for a user name, or a -1 if no match can be found
*/
-#if __STDC__
+#ifdef __STDC__
int
uid_name(char *name, uid_t *uid)
#else
@@ -416,7 +418,7 @@ uid_name(name, uid)
* the gid (if any) for a group name, or a -1 if no match can be found
*/
-#if __STDC__
+#ifdef __STDC__
int
gid_name(char *name, gid_t *gid)
#else
OpenPOWER on IntegriCloud