aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-06-20 09:56:47 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-06-20 09:56:47 +0000
commitbb0baed564489c678204a54d97cee9d57a4a1189 (patch)
tree8027fd51be4256f9d98a7f5298ef53b9beab85f9 /util-linux
parentbb98db2ed2140db5fd5c08112e257ed864aec646 (diff)
downloadbusybox-bb0baed564489c678204a54d97cee9d57a4a1189.tar.gz
- strndupa is a GNU extension. Using strdup to avoid several errors like:
util-linux/mdev.c:(.text+0x29a): undefined reference to `strndupa'
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mdev.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 8743cdb6b..22005aaee 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -90,7 +90,7 @@ static void make_device(char *path, int delete)
if (field == 0) {
/* Regex to match this device */
- char *regex = strndupa(pos, end2-pos);
+ char *regex = xstrndup(pos, end2-pos);
regex_t match;
regmatch_t off;
int result;
@@ -99,6 +99,7 @@ static void make_device(char *path, int delete)
xregcomp(&match,regex, REG_EXTENDED);
result = regexec(&match, device_name, 1, &off, 0);
regfree(&match);
+ free(regex);
/* If not this device, skip rest of line */
if (result || off.rm_so
@@ -119,7 +120,9 @@ static void make_device(char *path, int delete)
uid = strtoul(pos, &s2, 10);
if (s != s2) {
struct passwd *pass;
- pass = getpwnam(strndupa(pos, s-pos));
+ char *_unam = xstrndup(pos, s-pos);
+ pass = getpwnam(_unam);
+ free(_unam);
if (!pass) break;
uid = pass->pw_uid;
}
@@ -128,7 +131,9 @@ static void make_device(char *path, int delete)
gid = strtoul(s, &s2, 10);
if (end2 != s2) {
struct group *grp;
- grp = getgrnam(strndupa(s, end2-s));
+ char *_grnam = xstrndup(s, end2-s);
+ grp = getgrnam(_grnam);
+ free(_grnam);
if (!grp) break;
gid = grp->gr_gid;
}