Fix some compiler warnings emitted by gcc-4.8.0
[oweals/busybox.git] / util-linux / mkswap.c
index 61a786e92dd866df9d69de77257ed813ffcfbe05..b5d2c49b6b0e9fd8c1f50e5639b7f36b3c5adaff 100644 (file)
@@ -5,6 +5,13 @@
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
+
+//usage:#define mkswap_trivial_usage
+//usage:       "[-L LBL] BLOCKDEV [KBYTES]"
+//usage:#define mkswap_full_usage "\n\n"
+//usage:       "Prepare BLOCKDEV to be used as swap partition\n"
+//usage:     "\n       -L LBL  Label"
+
 #include "libbb.h"
 
 #if ENABLE_SELINUX
@@ -15,8 +22,7 @@ static void mkswap_selinux_setcontext(int fd, const char *path)
        if (!is_selinux_enabled())
                return;
 
-       if (fstat(fd, &stbuf) < 0)
-               bb_perror_msg_and_die("fstat failed");
+       xfstat(fd, &stbuf, path);
        if (S_ISREG(stbuf.st_mode)) {
                security_context_t newcon;
                security_context_t oldcon = NULL;