]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
nbd/003: fix compiling error with gcc version 4.8.5
authorYi Zhang <yi.zhang@redhat.com>
Thu, 20 Feb 2020 14:46:49 +0000 (22:46 +0800)
committerOmar Sandoval <osandov@fb.com>
Wed, 4 Mar 2020 18:15:13 +0000 (10:15 -0800)
cc  -O2 -Wall -Wshadow   -o mount_clear_sock mount_clear_sock.c
mount_clear_sock.c: In function ‘main’:
mount_clear_sock.c:39:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < loops; i++) {
  ^
mount_clear_sock.c:39:2: note: use option -std=c99 or -std=gnu99 to compile your code

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
src/mount_clear_sock.c

index 4030a4a8ff282c6e1ee158447917a7e6d668b6b0..984395eb27e77756f83e042fcfa34ac5e6ccb1eb 100644 (file)
@@ -18,7 +18,7 @@
 int main(int argc, char **argv)
 {
        const char *mountpoint, *dev, *fstype;
-       int loops, fd;
+       int loops, fd, i;
 
        if (argc != 5) {
                fprintf(stderr, "usage: %s DEV MOUNTPOINT FSTYPE LOOPS", argv[0]);
@@ -36,7 +36,7 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
        }
 
-       for (int i = 0; i < loops; i++) {
+       for (i = 0; i < loops; i++) {
                pid_t mount_pid, clear_sock_pid;
                int wstatus;