chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tmpfiles: open directories with O_NOATIME to preserve timestamp
[elogind.git]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index 40be2b2033b8767bc7673a25a452ad08259f1f4b..4e800e7430224f0a0219b1dd88fcea2e49cbc980 100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-1097,7
+1097,8
@@
static struct dual_timestamp* parse_initrd_timestamp(struct dual_timestamp *t) {
assert(t);
assert(t);
- if (!(e = getenv("RD_TIMESTAMP")))
+ e = getenv("RD_TIMESTAMP");
+ if (!e)
return NULL;
if (sscanf(e, "%llu %llu", &a, &b) != 2)
return NULL;
if (sscanf(e, "%llu %llu", &a, &b) != 2)
@@
-1150,7
+1151,8
@@
static void test_cgroups(void) {
"Systems without control groups are not supported. "
"We will now sleep for 10s, and then continue boot-up. "
"Expect breakage and please do not file bugs. "
"Systems without control groups are not supported. "
"We will now sleep for 10s, and then continue boot-up. "
"Expect breakage and please do not file bugs. "
- "Instead fix your kernel and enable CONFIG_CGROUPS." );
+ "Instead fix your kernel and enable CONFIG_CGROUPS. "
+ "Consult http://0pointer.de/blog/projects/cgroups-vs-cgroups.html for more information.");
sleep(10);
}
sleep(10);
}
@@
-1311,7
+1313,8
@@
int main(int argc, char *argv[]) {
/* Remember open file descriptors for later deserialization */
if (serialization) {
/* Remember open file descriptors for later deserialization */
if (serialization) {
- if ((r = fdset_new_fill(&fds)) < 0) {
+ r = fdset_new_fill(&fds);
+ if (r < 0) {
log_error("Failed to allocate fd set: %s", strerror(-r));
goto finish;
}
log_error("Failed to allocate fd set: %s", strerror(-r));
goto finish;
}
@@
-1330,15
+1333,22
@@
int main(int argc, char *argv[]) {
arg_running_as == MANAGER_SYSTEM);
if (arg_running_as == MANAGER_SYSTEM) {
arg_running_as == MANAGER_SYSTEM);
if (arg_running_as == MANAGER_SYSTEM) {
- /* Parse the data passed to us by the initrd and unset it */
+ /* Parse the data passed to us. We leave this
+ * variables set, but the manager later on will not
+ * pass them on to our children. */
parse_initrd_timestamp(&initrd_timestamp);
parse_initrd_timestamp(&initrd_timestamp);
- filter_environ("RD_");
/* Unset some environment variables passed in from the
* kernel that don't really make sense for us. */
unsetenv("HOME");
unsetenv("TERM");
/* Unset some environment variables passed in from the
* kernel that don't really make sense for us. */
unsetenv("HOME");
unsetenv("TERM");
+ /* When we are invoked by a shell, these might be set,
+ * but make little sense to pass on */
+ unsetenv("PWD");
+ unsetenv("SHLVL");
+ unsetenv("_");
+
/* 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 */
}
@@
-1621,6
+1631,11
@@
finish:
assert(i <= ELEMENTSOF(args));
assert(i <= ELEMENTSOF(args));
+ /* Close and disarm the watchdog, so that the new
+ * instance can reinitialize it, but doesn't get
+ * rebooted while we do that */
+ watchdog_close(true);
+
execv(args[0], (char* const*) args);
log_error("Failed to reexecute: %m");
execv(args[0], (char* const*) args);
log_error("Failed to reexecute: %m");