if (reboot(RB_DISABLE_CAD) < 0)
log_warning("Failed to enable ctrl-alt-del handling: %m");
- if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY)) < 0)
+ if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0)
log_warning("Failed to open /dev/tty0: %m");
else {
/* Enable that we get SIGWINCH on kbrequest */
assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1));
char_array_0(fn);
- if (!(f = fopen(fn, "r")))
+ if (!(f = fopen(fn, "re")))
return -errno;
if (!(fgets(line, sizeof(line), f))) {
assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1));
char_array_0(fn);
- if (!(f = fopen(fn, "r")))
+ if (!(f = fopen(fn, "re")))
return -errno;
if (!(fgets(line, sizeof(line), f))) {
if (asprintf(&p, "/proc/%lu/cmdline", (unsigned long) pid) < 0)
return -ENOMEM;
- f = fopen(p, "r");
+ f = fopen(p, "re");
free(p);
if (!f)
int r = 0, fd;
struct sigaction sa_old, sa_new;
- if ((fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_NDELAY)) < 0)
+ if ((fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_NDELAY|O_CLOEXEC)) < 0)
return -errno;
/* Temporarily ignore SIGHUP, so that we don't get SIGHUP'ed
return 1;
}
- if ((f = fopen("/proc/self/cgroup", "r"))) {
+ if ((f = fopen("/proc/self/cgroup", "re"))) {
for (;;) {
char line[LINE_MAX], *p;