summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-25 18:08:02 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-25 22:10:22 +0100
commit0bee65f0622c4faa8ac8ae771cc0c8a936dfa284 (patch)
tree7ee568dce15589f4b2d3e1d38220f6deb8ee847f /src/shared
parent26fefda707e6511733f48da03b281a004dba6abf (diff)
shutdown: during final killing spree also send SIGHUP in addition to SIGTERM to deal with shells
This makes shutdown a bit faster if debug-shell.service is enabled.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 97c9497df6..3a4d1965ae 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2525,10 +2525,8 @@ int get_ctty_devnr(pid_t pid, dev_t *d) {
char line[LINE_MAX], *p;
unsigned long ttynr;
const char *fn;
- int k;
assert(pid >= 0);
- assert(d);
if (pid == 0)
fn = "/proc/self/stat";
@@ -2539,10 +2537,8 @@ int get_ctty_devnr(pid_t pid, dev_t *d) {
if (!f)
return -errno;
- if (!fgets(line, sizeof(line), f)) {
- k = feof(f) ? -EIO : -errno;
- return k;
- }
+ if (!fgets(line, sizeof(line), f))
+ return feof(f) ? -EIO : -errno;
p = strrchr(line, ')');
if (!p)
@@ -2562,7 +2558,9 @@ int get_ctty_devnr(pid_t pid, dev_t *d) {
if (major(ttynr) == 0 && minor(ttynr) == 0)
return -ENOENT;
- *d = (dev_t) ttynr;
+ if (d)
+ *d = (dev_t) ttynr;
+
return 0;
}