pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/pkgtools/pkg_install/files/create
Module Name: pkgsrc
Committed By: jkoshy
Date: Sat Feb 3 10:58:37 UTC 2024
Modified Files:
pkgsrc/pkgtools/pkg_install/files/create: util.c
Log Message:
pkg_create: fail gracefully on encountering nameless uids and gids.
PR pkg/57888
Submitted by: Sunil Nimmagadda
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 pkgsrc/pkgtools/pkg_install/files/create/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/pkgtools/pkg_install/files/create/util.c
diff -u pkgsrc/pkgtools/pkg_install/files/create/util.c:1.8 pkgsrc/pkgtools/pkg_install/files/create/util.c:1.9
--- pkgsrc/pkgtools/pkg_install/files/create/util.c:1.8 Sun Oct 13 21:49:36 2019
+++ pkgsrc/pkgtools/pkg_install/files/create/util.c Sat Feb 3 10:58:37 2024
@@ -58,6 +58,8 @@
static void
update_ids(struct memory_file *file)
{
+ const char *s;
+
if (file->owner != NULL) {
uid_t uid;
@@ -65,7 +67,10 @@ update_ids(struct memory_file *file)
errx(2, "user %s unknown", file->owner);
file->st.st_uid = uid;
} else {
- file->owner = xstrdup(user_from_uid(file->st.st_uid, 1));
+ if ((s = user_from_uid(file->st.st_uid, 1)) == NULL)
+ errx(2, "unknown user name for uid %u",
+ (unsigned) file->st.st_uid);
+ file->owner = xstrdup(s);
}
if (file->group != NULL) {
@@ -75,7 +80,10 @@ update_ids(struct memory_file *file)
errx(2, "group %s unknown", file->group);
file->st.st_gid = gid;
} else {
- file->group = xstrdup(group_from_gid(file->st.st_gid, 1));
+ if ((s = group_from_gid(file->st.st_gid, 1)) == NULL)
+ errx(2, "unknown group name for gid %u",
+ (unsigned) file->st.st_gid);
+ file->group = xstrdup(s);
}
}
Home |
Main Index |
Thread Index |
Old Index