]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build: fix some compiler warnings
authorRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 29 May 2014 23:18:09 +0000 (01:18 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 29 May 2014 23:18:09 +0000 (01:18 +0200)
Most of them catched on 32bit gcc and icc.

disk-utils/fsck.cramfs.c:     printf format type
lib/boottime.c:               unused variables
misc-utils/cal.c:             set but never used
sys-utils/losetup.c:          set but never used
sys-utils/lscpu-dmi.c:        defined but not used
sys-utils/switch_root.c:      comparison between signed and unsigned
tests/helpers/test_sysinfo.c: printf format type

disk-utils/fsck.cramfs.c
lib/boottime.c
misc-utils/cal.c
sys-utils/losetup.c
sys-utils/lscpu-dmi.c
sys-utils/switch_root.c
tests/helpers/test_sysinfo.c

index d4967dccb7c38bd9f7b4689a0466539978fdf0b2..6adfa3334d2809f04eed6f48d75c16892c066da2 100644 (file)
@@ -618,11 +618,11 @@ static void test_fs(int start)
        if (start_data != ~0UL) {
                if (start_data < (sizeof(struct cramfs_super) + start))
                        errx(FSCK_EX_UNCORRECTED,
-                            _("directory data start (%ld) < sizeof(struct cramfs_super) + start (%ld)"),
+                            _("directory data start (%lu) < sizeof(struct cramfs_super) + start (%zu)"),
                             start_data, sizeof(struct cramfs_super) + start);
                if (end_dir != start_data)
                        errx(FSCK_EX_UNCORRECTED,
-                            _("directory data end (%ld) != file data start (%ld)"),
+                            _("directory data end (%lu) != file data start (%lu)"),
                             end_dir, start_data);
        }
        if (super.flags & CRAMFS_FLAG_FSID_VERSION_2)
index 335570cc1900b1a6ad8fafb8d19286139be62b93..a2869a50ba1526e03dec003d821542a8c8d4e7f6 100644 (file)
@@ -9,8 +9,11 @@
 
 int get_boot_time(struct timeval *boot_time)
 {
+#ifdef CLOCK_BOOTTIME
        struct timespec hires_uptime;
-       struct timeval lores_uptime, now;
+       struct timeval lores_uptime;
+#endif
+       struct timeval now;
        struct sysinfo info;
 
        if (gettimeofday(&now, NULL) != 0) {
index e763fe140a53afdffb94e0351165e79a698a9a14..1004266392217b6848e7c8ec1894ec1dd0ca674c 100644 (file)
@@ -137,7 +137,6 @@ static void my_putstring(char *s)
 
 #if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW) || defined(HAVE_LIBTERMCAP)
 static const char      *term="";
-static int             Slen;           /* strlen of Senter+Sexit */
 #endif
 
 static const char      *Senter="", *Sexit="";/* enter and exit standout mode */
@@ -304,7 +303,6 @@ int main(int argc, char **argv)
                if (ret > 0) {
                        Senter = my_tgetstr("so","smso");
                        Sexit = my_tgetstr("se","rmso");
-                       Slen = strlen(Senter) + strlen(Sexit);
                }
        }
 #endif
index ecba8a56ca4e8dd37a952ff21beec63b90d1adf9..6ad94be4cc8f6d6ee55b0177dda74f273d0f516d 100644 (file)
@@ -77,7 +77,6 @@ static struct colinfo infos[] = {
 
 static int columns[NCOLS] = {-1};
 static int ncolumns;
-static int verbose;
 
 static int get_column_id(int num)
 {
@@ -543,7 +542,6 @@ int main(int argc, char **argv)
                        showdev = 1;
                        break;
                case 'v':
-                       verbose = 1;
                        break;
                case 'V':
                        printf(UTIL_LINUX_VERSION);
index c82bfc134a00a3f05f4861f66b7d5562df581b5f..251d4acc40bdc3f6ff296e78182e4ab1de1b224c 100644 (file)
@@ -168,6 +168,7 @@ done:
        return rc;
 }
 
+#if defined(__x86_64__) || defined(__i386__)
 static int hypervisor_decode_legacy(uint8_t *buf, const char *devmem)
 {
        if (!checksum(buf, 0x0F))
@@ -177,6 +178,7 @@ static int hypervisor_decode_legacy(uint8_t *buf, const char *devmem)
                         WORD(buf + 0x0C),
                devmem);
 }
+#endif
 
 static int hypervisor_decode_smbios(uint8_t *buf, const char *devmem)
 {
index dac946f8c987517d36781872048ae8bc78fb23b6..6822a5d0cebe4379bc266e56241f9fd12fbf5ac4 100644 (file)
@@ -181,7 +181,8 @@ static int switchroot(const char *newroot)
                if (pid <= 0) {
                        struct statfs stfs;
                        if (fstatfs(cfd, &stfs) == 0 &&
-                           (stfs.f_type == STATFS_RAMFS_MAGIC || stfs.f_type == STATFS_TMPFS_MAGIC))
+                           (stfs.f_type == (__SWORD_TYPE)STATFS_RAMFS_MAGIC ||
+                            stfs.f_type == (__SWORD_TYPE)STATFS_TMPFS_MAGIC))
                                recursiveRemove(cfd);
                        else
                                warn(_("old root filesystem is not an initramfs"));
index 3983f28ef7198856697a7eb0ff3e7af77d924bb2..ce7bc081a51d0b3e68aece05b62936a7b1495269 100644 (file)
@@ -27,7 +27,7 @@ typedef struct {
 
 static int hlp_wordsize(void)
 {
-       printf("%lu\n", CHAR_BIT * sizeof(void*));
+       printf("%zu\n", CHAR_BIT * sizeof(void*));
        return 0;
 }