X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmount.c;h=b571db946d4f01c128398a70543afb005353ab6c;hb=cb6531bee6e6f66c3a9d85b24fed68fae7fad6ad;hp=8b787f66b09fadcab2bac588bf8a7ad9c148963b;hpb=a931ad47a8623163a29d898224d8a8c1177ffdaf;p=elogind.git diff --git a/src/core/mount.c b/src/core/mount.c index 8b787f66b..b571db946 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -814,19 +814,26 @@ fail: } void warn_if_dir_nonempty(const char *unit, const char* where) { + int r; + assert(unit); assert(where); - if (dir_is_empty(where) > 0) + r = dir_is_empty(where); + if (r > 0) return; - - log_struct_unit(LOG_NOTICE, - unit, - "MESSAGE=%s: Directory %s to mount over is not empty, mounting anyway.", - unit, where, - "WHERE=%s", where, - MESSAGE_ID(SD_MESSAGE_OVERMOUNTING), - NULL); + else if (r == 0) + log_struct_unit(LOG_NOTICE, + unit, + "MESSAGE=%s: Directory %s to mount over is not empty, mounting anyway.", + unit, where, + "WHERE=%s", where, + MESSAGE_ID(SD_MESSAGE_OVERMOUNTING), + NULL); + else + log_warning_unit(unit, + "MESSAGE=Failed to check directory %s: %s", + where, strerror(-r)); } static int fail_if_symlink(const char *unit, const char* where) {