summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-15 18:01:52 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-15 18:06:07 +0200
commit56d96fc00cd009e92e611c11f15c1bfb1b1eb9e8 (patch)
treec7b3e1707031ff089313919015098c6e6bc63d19 /src/shared/util.c
parent563b1bdc09efe0cf94dd3f514f30376ca854c1ce (diff)
main: minor code modernization for initializing the console
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index d6cea4d208..18d40f398f 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2084,12 +2084,14 @@ fail:
}
int release_terminal(void) {
- int r = 0;
- struct sigaction sa_old, sa_new = {
+ static const struct sigaction sa_new = {
.sa_handler = SIG_IGN,
.sa_flags = SA_RESTART,
};
- _cleanup_close_ int fd;
+
+ _cleanup_close_ int fd = -1;
+ struct sigaction sa_old;
+ int r = 0;
fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_NDELAY|O_CLOEXEC);
if (fd < 0)