summaryrefslogtreecommitdiffstats
path: root/libtar/output.c
diff options
context:
space:
mode:
authorJames Christopher Adduono <jc@adduono.com>2016-03-01 22:01:53 +0100
committerEthan Yonker <dees_troy@teamw.in>2016-03-02 20:04:11 +0100
commit6f57f7c60167b11e0e7769310aa8878d2980a3da (patch)
tree8c19ef8ad663ef7155b5b382085130d51c926a94 /libtar/output.c
parentUnix file endings and remove execute permission (diff)
downloadandroid_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar
android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.gz
android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.bz2
android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.lz
android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.xz
android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.tar.zst
android_bootable_recovery-6f57f7c60167b11e0e7769310aa8878d2980a3da.zip
Diffstat (limited to '')
-rw-r--r--libtar/output.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libtar/output.c b/libtar/output.c
index a2db9293c..d2bf8bb0c 100644
--- a/libtar/output.c
+++ b/libtar/output.c
@@ -13,6 +13,7 @@
#include <internal.h>
#include <stdio.h>
+#include <stdlib.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
@@ -83,14 +84,14 @@ th_print_long_ls(TAR *t)
uid = th_get_uid(t);
pw = getpwuid(uid);
- if (pw == NULL)
+ if ((t->options & TAR_USE_NUMERIC_ID) || pw == NULL)
snprintf(username, sizeof(username), "%d", uid);
else
strlcpy(username, pw->pw_name, sizeof(username));
gid = th_get_gid(t);
gr = getgrgid(gid);
- if (gr == NULL)
+ if ((t->options & TAR_USE_NUMERIC_ID) || gr == NULL)
snprintf(groupname, sizeof(groupname), "%d", gid);
else
strlcpy(groupname, gr->gr_name, sizeof(groupname));
@@ -99,7 +100,7 @@ th_print_long_ls(TAR *t)
printf("%.10s %-8.8s %-8.8s ", modestring, username, groupname);
if (TH_ISCHR(t) || TH_ISBLK(t))
- printf(" %3d, %3d ", th_get_devmajor(t), th_get_devminor(t));
+ printf(" %3d, %3d ", (int)th_get_devmajor(t), (int)th_get_devminor(t));
else
printf("%9ld ", (long)th_get_size(t));