]> git.armaanb.net Git - opendoas.git/blobdiff - persist_timestamp.c
persist_timestamp: use CLOCK_MONOTONIC_RAW
[opendoas.git] / persist_timestamp.c
index d4ffdd3ac8f38336b06467b993e07d486a769d72..c8f4bb5ddd70f4242e3c3b5d86c86163cc4b775c 100644 (file)
@@ -147,7 +147,7 @@ check:
 
        if ((st.st_mode & S_IFMT) != S_IFDIR)
                errx(1, "timestamp directory is not a directory");
-       if ((st.st_mode & (S_IWGRP|S_IRGRP|S_IWOTH|S_IROTH)) != 0)
+       if ((st.st_mode & (S_IWGRP|S_IRGRP|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH)) != 0)
                errx(1, "timestamp directory permissions wrong");
        if (st.st_uid != 0 || st.st_gid != 0)
                errx(1, "timestamp directory is not owned by root");
@@ -171,7 +171,7 @@ persist_check(int fd, int secs)
        if (!timespecisset(&ts_mono) || !timespecisset(&ts_real))
                errx(1, "timespecisset");
 
-       if (clock_gettime(CLOCK_MONOTONIC, &mono) == -1 ||
+       if (clock_gettime(CLOCK_MONOTONIC_RAW, &mono) == -1 ||
            clock_gettime(CLOCK_REALTIME, &real) == -1)
                err(1, "clock_gettime");
 
@@ -196,7 +196,7 @@ persist_set(int fd, int secs)
 {
        struct timespec mono, real, ts_mono, ts_real, timeout;
 
-       if (clock_gettime(CLOCK_MONOTONIC, &mono) == -1 ||
+       if (clock_gettime(CLOCK_MONOTONIC_RAW, &mono) == -1 ||
            clock_gettime(CLOCK_REALTIME, &real) == -1)
                err(1, "clock_gettime");