]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkswap: tolerate ENOTSUP when failing to relabel
authorLubomir Rintel <lkundrak@v3.sk>
Mon, 18 Apr 2016 07:01:23 +0000 (09:01 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Apr 2016 08:51:28 +0000 (10:51 +0200)
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 ...

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
disk-utils/mkswap.c

index a7c6a709b3f5e3378ad87bd0dca50b0457b7957e..e44d039e15c65136b459bed429581e3ff2b01d04 100644 (file)
@@ -522,7 +522,7 @@ int main(int argc, char **argv)
                context_string = context_str(newcontext);
 
                if (strcmp(context_string, oldcontext)!=0) {
-                       if (fsetfilecon(ctl.fd, context_string))
+                       if (fsetfilecon(ctl.fd, context_string) && errno != ENOTSUP)
                                err(EXIT_FAILURE, _("unable to relabel %s to %s"),
                                                ctl.devname, context_string);
                }