cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
Blob Blame History Raw
From a656eda4cf268f555563d45808df4bb1df54c95f Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 18 Apr 2016 09:01:23 +0200
Subject: [PATCH] mkswap: tolerate ENOTSUP when failing to relabel

It might be that the underlying filesystem just doesn't support SELinux
labeling. This fixes creating swap on vfat live media:

  # livecd-iso-to-disk.sh --msdos --swap-size-mb 666 ...

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1538545
Upstream: http://github.com/karelzak/util-linux/commit/d97dc0ee2505e80c8e9fca89aa2001b2ec2c3695
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
 disk-utils/mkswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index ec6fc5f99..ff47f2038 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -656,7 +656,7 @@ main(int argc, char **argv) {
 		context_string = context_str(newcontext);
 
 		if (strcmp(context_string, oldcontext)!=0) {
-			if (fsetfilecon(DEV, context_string))
+			if (fsetfilecon(DEV, context_string) && errno != ENOTSUP)
 				err(EXIT_FAILURE, _("unable to relabel %s to %s"),
 						device_name, context_string);
 		}
-- 
2.13.6