summaryrefslogtreecommitdiff
path: root/udev-add.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-03-09 19:50:15 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:35:08 -0700
commit17794d77b97fcb8af263bcecbe03dad5d0e9a89a (patch)
treefc87f4d731a6543aaae346875768ff57fc85413a /udev-add.c
parent3f20eac0a58dc3987200773a39163e30b60993fc (diff)
[PATCH] rename strn*() macros to strmax
Hey, I wrote the strn*() macros just 10 days ago and yesterday this trap caught me with the %c{x} bug. The names are misleading cause we all expect that the from field is limited by the size argument, but we actually limit the overall size of the destination string to prevent a overflow. Here we rename all strn*() macros to str*max(). That should be more self-explanatory.
Diffstat (limited to 'udev-add.c')
-rw-r--r--udev-add.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/udev-add.c b/udev-add.c
index de1fb953c4..ce723e45cc 100644
--- a/udev-add.c
+++ b/udev-add.c
@@ -141,7 +141,7 @@ static void set_to_local_user(char *user)
struct utmp *u;
time_t recent = 0;
- strnfieldcpy(user, default_owner_str, OWNER_SIZE);
+ strfieldcpymax(user, default_owner_str, OWNER_SIZE);
setutent();
while (1) {
u = getutent();
@@ -158,7 +158,7 @@ static void set_to_local_user(char *user)
if (u->ut_time > recent) {
recent = u->ut_time;
- strnfieldcpy(user, u->ut_user, OWNER_SIZE);
+ strfieldcpymax(user, u->ut_user, OWNER_SIZE);
dbg("local user is '%s'", user);
break;
}
@@ -282,7 +282,7 @@ static int create_node(struct udevice *dev, int fake)
/* create symlink if requested */
foreach_strpart(dev->symlink, " ", pos, len) {
- strnfieldcpy(linkname, pos, len+1);
+ strfieldcpymax(linkname, pos, len+1);
strfieldcpy(filename, udev_root);
strfieldcat(filename, linkname);
dbg("symlink '%s' to node '%s' requested", filename, dev->name);