]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: check HAVE_ definitions with #ifdef [smatch scan]
authorSami Kerola <kerolasa@iki.fi>
Thu, 1 Dec 2011 22:10:21 +0000 (23:10 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 2 Dec 2011 17:21:46 +0000 (18:21 +0100)
Fix to `warning: undefined preprocessor identifier' messages.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 files changed:
include/blkdev.h
include/md5.h
lib/env.c
lib/ismounted.c
libblkid/src/cache.c
libblkid/src/devname.c
libblkid/src/devno.c
libblkid/src/llseek.c
libblkid/src/read.c
libblkid/src/resolve.c
libblkid/src/version.c
misc-utils/cal.c
term-utils/script.c

index 3ce8111f67360d3ba81c67c46af9e6c758de73f2..1e7409dfd28e58e70b76d9ace6531efc19566269 100644 (file)
@@ -9,7 +9,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-#if HAVE_SYS_MKDEV_H
+#ifdef HAVE_SYS_MKDEV_H
 # include <sys/mkdev.h>                /* major and minor on Solaris */
 #endif
 
index 1222cf03014d640e1214a11940f7fe7779ee3e4b..d997e379d7cf0f9112fc2c8e38a404bc72555a78 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MD5_H
 #define MD5_H
 
-#if HAVE_STDINT_H
+#ifdef HAVE_STDINT_H
 #include <stdint.h>
 #else
 typedef unsigned int uint32_t;
index 770cadff92e696dc01fdd563990b27ec895c05be..e6d119f6fd62acca096a41eb92fd32e47cd7fc79 100644 (file)
--- a/lib/env.c
+++ b/lib/env.c
@@ -89,7 +89,7 @@ char *safe_getenv(const char *arg)
 
        if (ruid != 0 || (ruid != geteuid()) || (getgid() != getegid()))
                return NULL;
-#if HAVE_PRCTL
+#ifdef HAVE_PRCTL
        if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
                return NULL;
 #else
index f19d67b1e6ece5d3209ade624f2ba8605c69f3dc..273a7d9518630a8e54d52615b42bad31bcf1b392 100644 (file)
@@ -11,7 +11,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <fcntl.h>
-#if HAVE_MNTENT_H
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
 #endif
 #include <string.h>
index 6ef22a103e1e2e49d30a22138db4c51ea01fe49a..c100cfa2036b0effc04a928763a8defc34910f68 100644 (file)
@@ -10,7 +10,7 @@
  * %End-Header%
  */
 
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #ifdef HAVE_ERRNO_H
index 42a8c19a9dfb92d613254957c982370b118b333a..12cd93ad33001acbb1df1979696355417dac920d 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <limits.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <stdlib.h>
 #include <ctype.h>
 #include <fcntl.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 #include <dirent.h>
-#if HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
 #include <time.h>
index 92ed7c0259dd6d12ad1bf183145a1f94c376a723..b2a8be537c4da2379faf4e2abb39b0baae022379 100644 (file)
 
 #include <stdio.h>
 #include <string.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <stdlib.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
-#if HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
 #include <dirent.h>
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
-#if HAVE_SYS_MKDEV_H
+#ifdef HAVE_SYS_MKDEV_H
 #include <sys/mkdev.h>
 #endif
 #include <fcntl.h>
index 5bd0e516782a81bb99ebbadbebc033a01d076a24..7fb44c44d055fa2c064f779609222cb8bfd1f7d6 100644 (file)
 #define _LARGEFILE_SOURCE
 #define _LARGEFILE64_SOURCE
 
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #ifdef __MSDOS__
index c404bb010828f4f4649955d4eb2bf593ccd54661..b9fda3aaeedebd436cece2e3d4424a8f4b5e02dd 100644 (file)
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#if HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
 
 #include "blkidP.h"
 
-#if HAVE_STDLIB_H
+#ifdef HAVE_STDLIB_H
 # ifndef _XOPEN_SOURCE
 #  define _XOPEN_SOURCE 600    /* for inclusion of strtoull */
 # endif
index bf13b86488bb01b0dbccfa2aab361fb91faa9c01..bf5041df52275025c901588dbff5aa7d673bda28 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #include <stdio.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <stdlib.h>
index 4c7fa06ca65693493b65e3b5a96e47f542c7106f..63f02f6a9de1eb20b8bb18fb89d268aebed7f9cc 100644 (file)
@@ -9,7 +9,7 @@
  * %End-Header%
  */
 
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <string.h>
index 1c810ca85d6ae200c4d38c029f499179d2156e24..c9efdf074efa18cec251e3a22f0b99d84602cd97 100644 (file)
@@ -297,7 +297,7 @@ main(int argc, char **argv) {
  * the locale database, which can be overridden with the
  * -s (Sunday) or -m (Monday) options.
  */
-#if HAVE_DECL__NL_TIME_WEEK_1STDAY
+#ifdef HAVE_DECL__NL_TIME_WEEK_1STDAY
        /*
         * You need to use 2 locale variables to get the first day of the week.
         * This is needed to support first_weekday=2 and first_workday=1 for
index 3891bf952677a6513a800683a61f36f2486c0066..9e08ff62a6e20e108650f6264f23f29cf240f6c0 100644 (file)
 #include "nls.h"
 #include "c.h"
 
-#if HAVE_LIBUTIL && HAVE_PTY_H
-#include <pty.h>
+#ifdef HAVE_LIBUTIL
+# ifdef HAVE_PTY_H
+#  include <pty.h>
+# endif
 #endif
 
 #ifdef HAVE_LIBUTEMPTER
@@ -499,13 +501,15 @@ done(void) {
 
 void
 getmaster(void) {
-#if HAVE_LIBUTIL && HAVE_PTY_H
+#ifdef HAVE_LIBUTIL
+# ifdef HAVE_PTY_H
        tcgetattr(STDIN_FILENO, &tt);
        ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&win);
        if (openpty(&master, &slave, NULL, &tt, &win) < 0) {
                warn(_("openpty failed"));
                fail();
        }
+# endif
 #else
        char *pty, *bank, *cp;
        struct stat stb;