along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <string.h>
#include <unistd.h>
#include "util.h"
#include "mkdir.h"
#include "unit-name.h"
#include "generator.h"
+#include "path-util.h"
int generator_write_fsck_deps(
FILE *f,
const char *dest,
const char *what,
const char *where,
- const char *type) {
+ const char *fstype) {
assert(f);
+ assert(dest);
+ assert(what);
+ assert(where);
if (!is_device_path(what)) {
log_warning("Checking was requested for \"%s\", but it is not a device.", what);
return 0;
}
- if (type && !streq(type, "auto")) {
- const char *checker;
+ if (!isempty(fstype) && !streq(fstype, "auto")) {
int r;
-
- checker = strappenda("/sbin/fsck.", type);
- r = access(checker, X_OK);
+ r = fsck_exists(fstype);
if (r < 0) {
- log_warning("Checking was requested for %s, but %s cannot be used: %m", what, checker);
-
+ log_warning("Checking was requested for %s, but fsck.%s cannot be used: %s", what, fstype, strerror(-r));
/* treat missing check as essentially OK */
- return errno == ENOENT ? 0 : -errno;
+ return r == -ENOENT ? 0 : r;
}
}