From: Sami Kerola Date: Tue, 4 Aug 2015 21:46:26 +0000 (+0100) Subject: misc: fix redundant assignment and reassignments before use [cppcheck] X-Git-Tag: v2.27-rc2~22^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee24ab6f1;p=thirdparty%2Futil-linux.git misc: fix redundant assignment and reassignments before use [cppcheck] Signed-off-by: Sami Kerola --- diff --git a/lib/procutils.c b/lib/procutils.c index 00b977c5aa..48ee7cf06e 100644 --- a/lib/procutils.c +++ b/lib/procutils.c @@ -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); diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c index 3ee0b5d07d..150689a621 100644 --- a/sys-utils/blkdiscard.c +++ b/sys-utils/blkdiscard.c @@ -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]; diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c index c91141e274..6bbf1c99fc 100644 --- a/sys-utils/fstrim.c +++ b/sys-utils/fstrim.c @@ -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;