]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
misc: fix redundant assignment and reassignments before use [cppcheck]
authorSami Kerola <kerolasa@iki.fi>
Tue, 4 Aug 2015 21:46:26 +0000 (22:46 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 8 Aug 2015 06:46:39 +0000 (07:46 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
lib/procutils.c
sys-utils/blkdiscard.c
sys-utils/fstrim.c

index 00b977c5aa76d7b7f9928688862fa499491c9397..48ee7cf06eee306d5f24d6d0abb25c08e2bfb209 100644 (file)
@@ -103,7 +103,7 @@ char *proc_get_command(pid_t pid)
        char buf[BUFSIZ], *res = NULL;
        ssize_t sz = 0;
        size_t i;
-       int fd = -1;
+       int fd;
 
        snprintf(buf, sizeof(buf), "/proc/%d/cmdline", (int) pid);
        fd = open(buf, O_RDONLY);
index 3ee0b5d07d505b09a08700fa6f9b65efcab1df06..150689a62182e31180e80fb77175d09349a2a1bc 100644 (file)
@@ -185,7 +185,7 @@ int main(int argc, char **argv)
        stats[0] = range[0], stats[1] = 0;
        gettime_monotonic(&last);
 
-       for (range[0] = range[0]; range[0] < end; range[0] += range[1]) {
+       for (/* nothing */; range[0] < end; range[0] += range[1]) {
                if (range[0] + range[1] > end)
                        range[1] = end - range[0];
 
index c91141e274e3042fd56f2110f4d6dcf9237f8348..6bbf1c99fcda08f2d06076fe1ff21462fde496ef 100644 (file)
@@ -60,7 +60,7 @@ struct fstrim_range {
 static int fstrim_filesystem(const char *path, struct fstrim_range *rangetpl,
                            int verbose)
 {
-       int fd = -1, rc;
+       int fd, rc;
        struct stat sb;
        struct fstrim_range range;