summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-03 23:20:39 +0200
committerLennart Poettering <lennart@poettering.net>2011-07-05 03:29:24 +0200
commitccaa61498c7932cbd5c91540841840266914b10e (patch)
treed8c0ba34822098dfc89825f7972592746ab78a9b /src
parentb5ef5549e9889eea1c66c4ed88667b5922cd9f76 (diff)
add a few O_CLOEXEC where missing
Diffstat (limited to 'src')
-rw-r--r--src/manager.c2
-rw-r--r--src/util.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/manager.c b/src/manager.c
index 258b3ca4b7..7b725e34d8 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -136,7 +136,7 @@ static int enable_special_signals(Manager *m) {
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 */
diff --git a/src/util.c b/src/util.c
index f75df7b511..ca769c22e6 100644
--- a/src/util.c
+++ b/src/util.c
@@ -490,7 +490,7 @@ int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
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))) {
@@ -535,7 +535,7 @@ int get_starttime_of_pid(pid_t pid, unsigned long long *st) {
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))) {
@@ -1010,7 +1010,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, char **line) {
if (asprintf(&p, "/proc/%lu/cmdline", (unsigned long) pid) < 0)
return -ENOMEM;
- f = fopen(p, "r");
+ f = fopen(p, "re");
free(p);
if (!f)
@@ -2656,7 +2656,7 @@ int release_terminal(void) {
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
@@ -4272,7 +4272,7 @@ int detect_container(const char **id) {
return 1;
}
- if ((f = fopen("/proc/self/cgroup", "r"))) {
+ if ((f = fopen("/proc/self/cgroup", "re"))) {
for (;;) {
char line[LINE_MAX], *p;