udevtrigger: remove superfluous strlcpy
authorGabor Juhos <juhosg@openwrt.org>
Wed, 11 Sep 2013 14:10:13 +0000 (16:10 +0200)
committerJohn Crispin <blogic@openwrt.org>
Fri, 13 Sep 2013 15:36:58 +0000 (17:36 +0200)
Use the "/sys/class/block" string directly
for the stat call. This makes the code simpler
and reduces stack usage.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
udevtrigger.c

index e09ad98c6c5f543b7a202509d518a89c2d4c1d95..2f1af35488159d1ae10002a3907a9cdda5cc8556 100644 (file)
@@ -295,7 +295,6 @@ static void scan_class(void)
 
 int main(int argc, char *argv[], char *envp[])
 {
-       char base[PATH_SIZE];
        struct stat statbuf;
        int option;
 
@@ -331,8 +330,7 @@ int main(int argc, char *argv[], char *envp[])
        scan_class();
 
        /* scan "block" if it isn't a "class" */
-       strlcpy(base, "/sys/class/block", sizeof(base));
-       if (stat(base, &statbuf) != 0)
+       if (stat("/sys/class/block", &statbuf) != 0)
                scan_block();
 
 exit: