diff options
author | Sami Kerola | 2015-10-31 20:21:17 +0100 |
---|---|---|
committer | Karel Zak | 2015-11-09 09:56:14 +0100 |
commit | a4aeb5bd80a0db763c71d380c2132fb6c34c0e1f (patch) | |
tree | dbbc531afd1517345c0d1518ddc81b1a10f5df53 /term-utils/script.c | |
parent | agetty: fix chown(3), chmod(3) and open(3) race (diff) | |
download | kernel-qcow2-util-linux-a4aeb5bd80a0db763c71d380c2132fb6c34c0e1f.tar.gz kernel-qcow2-util-linux-a4aeb5bd80a0db763c71d380c2132fb6c34c0e1f.tar.xz kernel-qcow2-util-linux-a4aeb5bd80a0db763c71d380c2132fb6c34c0e1f.zip |
script, hwclock: check file exist with access(3) rather than stat(3)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'term-utils/script.c')
-rw-r--r-- | term-utils/script.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/term-utils/script.c b/term-utils/script.c index b6227c08e..e247c83cf 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -609,7 +609,6 @@ static void getmaster(struct script_control *ctl) } #else char *pty, *bank, *cp; - struct stat stb; ctl->isterm = isatty(STDIN_FILENO); @@ -617,7 +616,7 @@ static void getmaster(struct script_control *ctl) for (bank = "pqrs"; *bank; bank++) { ctl->line[strlen("/dev/pty")] = *bank; *pty = '0'; - if (stat(ctl->line, &stb) < 0) + if (access(ctl->line, F_OK) != 0) break; for (cp = "0123456789abcdef"; *cp; cp++) { *pty = *cp; |