summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-util.c
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2014-01-14 12:20:25 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-01-14 12:20:25 -0500
commitb8ed8b124aaff754e244dff6930b36c192fa69e0 (patch)
treec6d7caf75d42584eaf0227332d6c43ecc76d7565 /src/libudev/libudev-util.c
parentfd98dfdcb889c74c84a00e54e8094f9c91387c6a (diff)
src/libudev: bring in line with upstream
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev/libudev-util.c')
-rw-r--r--src/libudev/libudev-util.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 2c31d5b1db..6087c8f106 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -87,11 +87,8 @@ uid_t util_lookup_user(struct udev *udev, const char *user)
struct passwd *pw;
uid_t uid;
size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
- char *buf;
+ char *buf = alloca(buflen);
- if (buflen == -1)
- buflen = 1024;
- buf = alloca(buflen);
if (streq(user, "root"))
return 0;
uid = strtoul(user, &endptr, 10);
@@ -114,11 +111,9 @@ gid_t util_lookup_group(struct udev *udev, const char *group)
struct group grbuf;
struct group *gr;
gid_t gid = 0;
- size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
char *buf = NULL;
- if (buflen == -1)
- buflen = 1024;
if (streq(group, "root"))
return 0;
gid = strtoul(group, &endptr, 10);