svn commit: trunk/busybox/util-linux

aldot at busybox.net aldot at busybox.net
Wed Jun 20 02:56:51 PDT 2007


Author: aldot
Date: 2007-06-20 02:56:47 -0700 (Wed, 20 Jun 2007)
New Revision: 18862

Log:
- strndupa is a GNU extension. Using strdup to avoid several errors like:
  util-linux/mdev.c:(.text+0x29a): undefined reference to `strndupa'


Modified:
   trunk/busybox/util-linux/mdev.c


Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2007-06-19 23:04:17 UTC (rev 18861)
+++ trunk/busybox/util-linux/mdev.c	2007-06-20 09:56:47 UTC (rev 18862)
@@ -90,7 +90,7 @@
 				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 @@
 					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 @@
 					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 @@
 					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;
 					}



More information about the busybox-cvs mailing list