summaryrefslogtreecommitdiff
path: root/src/fstab-generator
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2012-11-27 01:09:28 +0100
committerTom Gundersen <teg@jklm.no>2012-11-27 01:57:57 +0100
commit67ab5f761f9b854d8ce85f9ee47b298e497f8bd9 (patch)
tree30d2a137471b7b43d717f1c67388751ceee76200 /src/fstab-generator
parent1d634e21b453f3c80d7c6c4bd90a6b84e42a3d2a (diff)
fstab-generator: make error more helpful in case of duplicates in fstab
Traditional sysvinit systems would not complain about duplicates in fstab. Rather it (through monut -a) would mount one fs on top of another, in effect the last entry taking precedent. In systemd, the first entry takes precedent, all subsequent ones are ignored and an error is printed. The change of behavior and the source of this error message was causing some confusion, so give a hint what migt be wrong.
Diffstat (limited to 'src/fstab-generator')
-rw-r--r--src/fstab-generator/fstab-generator.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 7b3bf11eda..ba55f2c2b7 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;
}
@@ -254,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;
}