sulogin: make fopen O_CLOEXEC specifier usage portable
The close at exit specifier "e" is glibc extension, so use it only if when the extension is available. Proposed-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
760e5e682d
commit
400423824a
|
@ -160,7 +160,7 @@ char *oneline(const char *file)
|
|||
|
||||
DBG(dbgprint("reading %s", file));
|
||||
|
||||
if (!(fp = fopen(file, "re")))
|
||||
if (!(fp = fopen(file, "r" UL_CLOEXECSTR)))
|
||||
return NULL;
|
||||
len = getline(&ret, &dummy, fp);
|
||||
if (len >= 0) {
|
||||
|
@ -361,7 +361,7 @@ static int detect_consoles_from_proc(struct list_head *consoles)
|
|||
|
||||
DBG(dbgprint("trying /proc"));
|
||||
|
||||
fc = fopen("/proc/consoles", "re");
|
||||
fc = fopen("/proc/consoles", "r" UL_CLOEXECSTR);
|
||||
if (!fc) {
|
||||
rc = 2;
|
||||
goto done;
|
||||
|
|
Loading…
Reference in New Issue