1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00

mount: don't fail if fstab doesn't exist

This commit is contained in:
Lennart Poettering 2012-04-22 15:33:43 +02:00
parent 59e132a7f4
commit e0295d2651
3 changed files with 10 additions and 3 deletions

View File

@ -1537,8 +1537,9 @@ static int mount_load_etc_fstab(Manager *m) {
assert(m);
errno = 0;
if (!(f = setmntent("/etc/fstab", "r")))
return -errno;
f = setmntent("/etc/fstab", "r");
if (!f)
return errno == ENOENT ? 0 : -errno;
while ((me = getmntent(f))) {
char *where, *what;

View File

@ -190,7 +190,8 @@ static char *disk_mount_point(const char *label) {
if (asprintf(&device, "/dev/mapper/%s", label) < 0)
goto finish;
if (!(f = setmntent("/etc/fstab", "r")))
f = setmntent("/etc/fstab", "r");
if (!f)
goto finish;
while ((m = getmntent(f)))

View File

@ -56,6 +56,11 @@ int main(int argc, char *argv[]) {
f = setmntent("/etc/fstab", "r");
if (!f) {
if (errno == ENOENT) {
ret = EXIT_SUCCESS;
goto finish;
}
log_error("Failed to open /etc/fstab: %m");
goto finish;
}