OSDN Git Service

Use stpcpy() (posix 2008) for slight code shrink.
authorRob Landley <rob@landley.net>
Thu, 9 Feb 2012 01:29:39 +0000 (19:29 -0600)
committerRob Landley <rob@landley.net>
Thu, 9 Feb 2012 01:29:39 +0000 (19:29 -0600)
lib/getmountlist.c

index 8410a92..1b23544 100644 (file)
@@ -33,10 +33,8 @@ struct mtab_list *getmountlist(int die)
                        stat(me.mnt_dir, &(mt->stat));
                        statvfs(me.mnt_dir, &(mt->statvfs));
                        // Remember information from /proc/mounts
-                       strcpy(mt->type, me.mnt_type);
-                       mt->dir = mt->type + strlen(mt->type) + 1;
-                       strcpy(mt->dir, me.mnt_dir);
-                       mt->device = mt->dir + strlen(mt->dir) + 1;
+                       mt->dir = stpcpy(mt->type, me.mnt_type) + 1;
+                       mt->device = stpcpy(mt->dir, me.mnt_dir) + 1;
                        strcpy(mt->device, me.mnt_fsname);
                        mtlist = mt;
                }