HALF ECHO LEARN / REFERENCE COLLECTION

v262.2

src/mountfsd/mountfsd.c

1,079 bytesGit mode 100644Download original fileLGPL-2.1-or-later

Git blob: fa2aa735dfa2408eb3a0c1cd2074f1e1dd35e32c

Lines 1–42 of 42

/* SPDX-License-Identifier: LGPL-2.1-or-later */
 
#include <sys/stat.h>
 
#include "sd-event.h"
 
#include "daemon-util.h"
#include "log.h"
#include "main-func.h"
#include "mountfsd-manager.h"
 
static int run(int argc, char *argv[]) {
        _unused_ _cleanup_(notify_on_cleanup) const char *notify_stop = NULL;
        _cleanup_(manager_freep) Manager *m = NULL;
        int r;
 
        log_setup();
 
        umask(0022);
 
        if (argc != 1)
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
 
        r = manager_new(&m);
        if (r < 0)
                return log_error_errno(r, "Could not create manager: %m");
 
        r = manager_startup(m);
        if (r < 0)
                return log_error_errno(r, "Failed to start up daemon: %m");
 
        notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
 
        r = sd_event_loop(m->event);
        if (r < 0)
                return log_error_errno(r, "Event loop failed: %m");
 
        return r;
}
 
DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);