fix compiler warnings
authorChristoph Hellwig <hch@lst.de>
Wed, 31 Dec 2008 11:52:05 +0000 (12:52 +0100)
committerChristoph Hellwig <hch@brick.lst.de>
Wed, 31 Dec 2008 11:52:05 +0000 (12:52 +0100)
Include all nessecary headers, use the correct format strings and don't
redefine _GNU_SOURCE.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
dmapi/src/suite2/src/mmap.c
src/bulkstat_unlink_test.c
src/bulkstat_unlink_test_modified.c
src/ftrunc.c
src/locktest.c
src/looptest.c
src/makeextents.c
src/trunc.c

index 721d0f7c5ac730eeb5a0bfa5708428708957efd8..983fe7de4fa125cebf7fc7e5015b3ca67c4c7bd9 100644 (file)
@@ -41,6 +41,7 @@
 #include <string.h>
 #include <errno.h>
 #include <getopt.h>
+#include <stdlib.h>
 
 
 char * Progname;
index 91631406516178b737c36ffa21e634b9b3722e35..17d07c077c0d4cc081247d68f758c8b6667469a1 100644 (file)
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
                                for (j=0; j < nfiles; j += stride) {
                                        if (ret[i].bs_ino == inodelist[j]) {
                                                /* oops ... */
-                                               printf("failed. Unlinked inode %ld returned by bulkstat\n", inodelist[j]);
+                                               printf("failed. Unlinked inode %llu returned by bulkstat\n", (unsigned long long)inodelist[j]);
                                                exit(1);
                                        }
                                }
index 7f1a98aff33fb36840f53dd2d496a225ee44deb1..4acc91291b418982a4f86632d320fb3f9d21537e 100644 (file)
@@ -160,9 +160,10 @@ main(int argc, char *argv[])
                    if ((ret[i].bs_ino == inodelist[j]) &&
                        (ret[i].bs_gen == genlist[j])) {
                        /* oops, the same inode with old gen number */
-                       printf("Unlinked inode %ld with generation %d "
+                       printf("Unlinked inode %llu with generation %d "
                               "returned by bulkstat\n",
-                               inodelist[j], genlist[j]);
+                               (unsigned long long)inodelist[j],
+                                genlist[j]);
                        exit(1);
                    }
                    if ((ret[i].bs_ino == inodelist[j])) {
index 8eeca33c9bdd6277858aac5fc50762dec820054d..1587e0d2c4486fd4b75957db78b70e11394c8fbb 100644 (file)
@@ -21,6 +21,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 int
 main(argc, argv)
index fa6ea66c28d0d8ac6c3d2cfd5a57113763ca774e..e35f6a6ac5bb761281d18b7d0af6dbe67b9c426b 100644 (file)
@@ -797,7 +797,7 @@ main(int argc, char *argv[])
     int                c;
     struct sockaddr_in myAddr;
     struct linger      noLinger = {1, 0};
-    char       *host;
+    char       *host = NULL;
     char       *endnum;
     int                errflag = 0;
     char       *p;
index ab8e41ed16e4fd78e2218fdd147591aa9ab8ef7c..d951f2b84b6ff1cdb29a78302110cc24f1aff2b1 100755 (executable)
@@ -28,8 +28,6 @@
  
 /* dxm - 28/2/2 */
 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <malloc.h>
index 46893ebd244beda9d408c3079541330335295f29..8183edb1c85673e1ca17b6475339424187ab6077 100644 (file)
@@ -119,7 +119,9 @@ main(int argc, char *argv[])
                                return 1;
                        }
                        if (verbose_opt) {
-                               printf("truncating back to %lu\n", NUMHOLES_TO_SIZE(num_holes));
+                               printf("truncating back to %llu\n",
+                                      (unsigned long long)
+                                       NUMHOLES_TO_SIZE(num_holes));
                        }
                        return 0;
                }
@@ -128,7 +130,8 @@ main(int argc, char *argv[])
                curr_holes = 0;
        }
        if (curr_holes != 0 && verbose_opt) {
-               printf("creating %lu more holes\n", num_holes - curr_holes);
+               printf("creating %llu more holes\n",
+                       (unsigned long long)num_holes - curr_holes);
        }
                
        /* create holes by seeking and writing */
@@ -147,7 +150,8 @@ main(int argc, char *argv[])
                }
 
                if (verbose_opt && ((i+1) % status_num == 0)) {
-                       printf("seeked and wrote %lu times\n", i+1);
+                       printf("seeked and wrote %llu times\n",
+                               (unsigned long long)i + 1);
                }
        }
 
index 854420d7e1d14b2754c094a6554509c54d55cf0f..1a20ef95e6d9f438eab8e50310798a29326c9c6d 100644 (file)
@@ -23,6 +23,8 @@
 #include <errno.h>
 #include <time.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #define O_DIRECT       040000
 
@@ -65,10 +67,10 @@ while((c=getopt(argc,argv,"f:"))!=EOF) {
                }
        }
 
-       err = posix_memalign(&buf, ALIGNMENT, BUFSIZE);
+       err = posix_memalign((void **)&buf, ALIGNMENT, BUFSIZE);
        if (err < 0) perror("posix_memalign failed");
 
-       err = posix_memalign(&goodbuf, ALIGNMENT, BUFSIZE);
+       err = posix_memalign((void **)&goodbuf, ALIGNMENT, BUFSIZE);
        if (err < 0) perror("posix_memalign failed");
 
        err = unlink(filename);