Code

Use sizeof() instead of duplicating the variable length
authorDagobert Michelsen <dam@opencsw.org>
Thu, 28 May 2015 11:22:29 +0000 (13:22 +0200)
committerDagobert Michelsen <dam@opencsw.org>
Thu, 28 May 2015 11:22:29 +0000 (13:22 +0200)
src/zone.c

index e4aad81513bb2b9858139d3990e31de924f6b73f..385e5116af87b67b1bc67761dad82718d2859e1b 100644 (file)
@@ -64,7 +64,7 @@ zone_read_procfile(char *pidstr, char *file, void *buf, size_t bufsize)
        int fd;
 
        char procfile[MAX_PROCFS_PATH];
-       (void)snprintf(procfile, MAX_PROCFS_PATH, "/proc/%s/%s", pidstr, file);
+       (void)snprintf(procfile, sizeof(procfile), "/proc/%s/%s", pidstr, file);
        while ((fd = open(procfile, O_RDONLY)) == -1) {
                if ((errno != EMFILE) || (errno != ENFILE)) {
                        return(1);