summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock.c
diff options
context:
space:
mode:
authorSami Kerola2015-10-31 20:21:17 +0100
committerKarel Zak2015-11-09 09:56:14 +0100
commita4aeb5bd80a0db763c71d380c2132fb6c34c0e1f (patch)
treedbbc531afd1517345c0d1518ddc81b1a10f5df53 /sys-utils/hwclock.c
parentagetty: fix chown(3), chmod(3) and open(3) race (diff)
downloadkernel-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 'sys-utils/hwclock.c')
-rw-r--r--sys-utils/hwclock.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 4b201d709..0d110617e 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -258,15 +258,12 @@ hw_clock_is_utc(const bool utc, const bool local_opt,
static int read_adjtime(struct adjtime *adjtime_p)
{
FILE *adjfile;
- int rc; /* local return code */
- struct stat statbuf; /* We don't even use the contents of this. */
char line1[81]; /* String: first line of adjtime file */
char line2[81]; /* String: second line of adjtime file */
char line3[81]; /* String: third line of adjtime file */
long timeval;
- rc = stat(adj_file_name, &statbuf);
- if (rc < 0 && errno == ENOENT) {
+ if (access(adj_file_name, R_OK) != 0) {
/* He doesn't have a adjtime file, so we'll use defaults. */
adjtime_p->drift_factor = 0;
adjtime_p->last_adj_time = 0;