From 934df30dd0af1a0cc01dab690aca566bfc5f0e7a Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 22 Dec 2011 12:18:43 +0100 Subject: losetup: cleanup headers, cmdline checks Signed-off-by: Karel Zak --- sys-utils/losetup.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'sys-utils/losetup.c') diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c index 32fcc474f..35c1c919d 100644 --- a/sys-utils/losetup.c +++ b/sys-utils/losetup.c @@ -6,26 +6,18 @@ */ #include #include -#include -#include #include #include #include #include #include -#include -#include #include -#include #include -#include -#include "strutils.h" +#include "c.h" #include "nls.h" -#include "pathnames.h" +#include "strutils.h" #include "loopdev.h" -#include "xalloc.h" -#include "canonicalize.h" enum { A_CREATE = 1, /* setup a new device */ @@ -373,7 +365,8 @@ int main(int argc, char **argv) _("the options %s are allowed to loop device setup only"), "--{encryption,sizelimit,pass-fd,read-only,show}"); - if (act != A_CREATE && act != A_SHOW && (flags & LOOPDEV_FL_OFFSET)) + if ((flags & LOOPDEV_FL_OFFSET) && + act != A_CREATE && (act != A_SHOW || !file)) errx(EXIT_FAILURE, _("the option --offset is not allowed in this context.")); switch (act) { -- cgit v1.2.3-55-g7522