X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ffstab-generator%2Ffstab-generator.c;h=ba55f2c2b73d0ce09bbd59232b4cbbe54c94e998;hp=bb4dd97b690f55c423b2a32845bbffb84941ba72;hb=67ab5f761f9b854d8ce85f9ee47b298e497f8bd9;hpb=a83cbaccd03c3f28e47e9330f4a22ff65ce4b561 diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index bb4dd97b6..ba55f2c2b 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -111,7 +111,10 @@ static int add_swap(const char *what, struct mntent *me) { f = fopen(unit, "wxe"); if (!f) { r = -errno; - log_error("Failed to create unit file %s: %m", unit); + if (errno == EEXIST) + log_error("Failed to create swap unit file %s, as it already exists. Duplicate entry in /etc/fstab?", unit); + else + log_error("Failed to create unit file %s: %m", unit); goto finish; } @@ -191,12 +194,6 @@ finish: return r; } -static bool mount_is_bind(struct mntent *me) { - assert(me); - - return hasmntopt(me, "bind"); -} - static bool mount_is_network(struct mntent *me) { assert(me); @@ -229,7 +226,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) { return 0; isnetwork = mount_is_network(me); - isbind = mount_is_bind(me); + isbind = !!hasmntopt(me, "bind"); noauto = !!hasmntopt(me, "noauto"); nofail = !!hasmntopt(me, "nofail"); @@ -260,7 +257,10 @@ static int add_mount(const char *what, const char *where, struct mntent *me) { f = fopen(unit, "wxe"); if (!f) { r = -errno; - log_error("Failed to create unit file %s: %m", unit); + if (errno == EEXIST) + log_error("Failed to create mount unit file %s, as it already exists. Duplicate entry in /etc/fstab?", unit); + else + log_error("Failed to create unit file %s: %m", unit); goto finish; }