chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
efi: set a nice description string in the ESP units
[elogind.git]
/
src
/
core
/
main.c
diff --git
a/src/core/main.c
b/src/core/main.c
index 4da8ecb86453d8336e998f1c400b34dc3ab74f54..1ee3c9c0e826eae390854928569780cbc74469d6 100644
(file)
--- a/
src/core/main.c
+++ b/
src/core/main.c
@@
-55,7
+55,9
@@
#include "mount-setup.h"
#include "loopback-setup.h"
#include "mount-setup.h"
#include "loopback-setup.h"
+#ifdef HAVE_KMOD
#include "kmod-setup.h"
#include "kmod-setup.h"
+#endif
#include "hostname-setup.h"
#include "machine-id-setup.h"
#include "locale-setup.h"
#include "hostname-setup.h"
#include "machine-id-setup.h"
#include "locale-setup.h"
@@
-932,14
+934,18
@@
static int parse_argv(int argc, char *argv[]) {
int fd;
FILE *f;
int fd;
FILE *f;
- if ((r = safe_atoi(optarg, &fd)) < 0 || fd < 0) {
+ r = safe_atoi(optarg, &fd);
+ if (r < 0 || fd < 0) {
log_error("Failed to parse deserialize option %s.", optarg);
log_error("Failed to parse deserialize option %s.", optarg);
- return r;
+ return r
< 0 ? r : -EINVAL
;
}
}
- if (!(f = fdopen(fd, "r"))) {
+ fd_cloexec(fd, true);
+
+ f = fdopen(fd, "r");
+ if (!f) {
log_error("Failed to open serialization fd: %m");
log_error("Failed to open serialization fd: %m");
- return
r
;
+ return
-errno
;
}
if (serialization)
}
if (serialization)
@@
-1058,7
+1064,6
@@
static int help(void) {
static int version(void) {
puts(PACKAGE_STRING);
static int version(void) {
puts(PACKAGE_STRING);
- puts(DISTRIBUTION);
puts(SYSTEMD_FEATURES);
return 0;
puts(SYSTEMD_FEATURES);
return 0;
@@
-1472,16
+1477,15
@@
int main(int argc, char *argv[]) {
log_close();
/* Remember open file descriptors for later deserialization */
log_close();
/* Remember open file descriptors for later deserialization */
- if (serialization) {
- r = fdset_new_fill(&fds);
- if (r < 0) {
-
log_error("Failed to allocate fd set: %s", strerror(-r))
;
- goto finish;
- }
+ r = fdset_new_fill(&fds);
+ if (r < 0) {
+ log_error("Failed to allocate fd set: %s", strerror(-r));
+
goto finish
;
+ } else
+ fdset_cloexec(fds, true);
+ if (serialization)
assert_se(fdset_remove(fds, fileno(serialization)) >= 0);
assert_se(fdset_remove(fds, fileno(serialization)) >= 0);
- } else
- close_all_fds(NULL, 0);
/* Set up PATH unless it is already set */
setenv("PATH",
/* Set up PATH unless it is already set */
setenv("PATH",
@@
-1516,6
+1520,12
@@
int main(int argc, char *argv[]) {
unsetenv("USER");
unsetenv("LOGNAME");
unsetenv("USER");
unsetenv("LOGNAME");
+ /* We suppress the socket activation env vars, as
+ * we'll try to match *any* open fd to units if
+ * possible. */
+ unsetenv("LISTEN_FDS");
+ unsetenv("LISTEN_PID");
+
/* All other variables are left as is, so that clients
* can still read them via /proc/1/environ */
}
/* All other variables are left as is, so that clients
* can still read them via /proc/1/environ */
}
@@
-1556,7
+1566,7
@@
int main(int argc, char *argv[]) {
if (arg_running_as == SYSTEMD_SYSTEM) {
const char *virtualization = NULL;
if (arg_running_as == SYSTEMD_SYSTEM) {
const char *virtualization = NULL;
- log_info(PACKAGE_STRING " running in system mode. (" SYSTEMD_FEATURES "
; " DISTRIBUTION "
)");
+ log_info(PACKAGE_STRING " running in system mode. (" SYSTEMD_FEATURES ")");
detect_virtualization(&virtualization);
if (virtualization)
detect_virtualization(&virtualization);
if (virtualization)
@@
-1566,7
+1576,7
@@
int main(int argc, char *argv[]) {
log_info("Running in initial RAM disk.");
} else
log_info("Running in initial RAM disk.");
} else
- log_debug(PACKAGE_STRING " running in user mode. (" SYSTEMD_FEATURES "
; " DISTRIBUTION "
)");
+ log_debug(PACKAGE_STRING " running in user mode. (" SYSTEMD_FEATURES ")");
if (arg_running_as == SYSTEMD_SYSTEM && !skip_setup) {
locale_setup();
if (arg_running_as == SYSTEMD_SYSTEM && !skip_setup) {
locale_setup();
@@
-1574,7
+1584,9
@@
int main(int argc, char *argv[]) {
if (arg_show_status || plymouth_running())
status_welcome();
if (arg_show_status || plymouth_running())
status_welcome();
+#ifdef HAVE_KMOD
kmod_setup();
kmod_setup();
+#endif
hostname_setup();
machine_id_setup();
loopback_setup();
hostname_setup();
machine_id_setup();
loopback_setup();
@@
-1649,10
+1661,7
@@
int main(int argc, char *argv[]) {
/* This will close all file descriptors that were opened, but
* not claimed by any unit. */
/* This will close all file descriptors that were opened, but
* not claimed by any unit. */
- if (fds) {
- fdset_free(fds);
- fds = NULL;
- }
+ fdset_free(fds);
if (serialization) {
fclose(serialization);
if (serialization) {
fclose(serialization);