summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-06-08 17:19:31 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-06-08 17:19:31 +0000
commite0ba36baccc0df5a3fa521c3ceb68bb1ffa434b7 (patch)
tree38e83bc25b2bd9e79f4e501c7a4a16a83d30d75e /gpsd.c
parent9b8846073f9ebfc8fcff9d42cfe511a08fa14f72 (diff)
downloadgpsd-e0ba36baccc0df5a3fa521c3ceb68bb1ffa434b7.tar.gz
Ensure that we don't try to change GID or set the system clock when non-root.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gpsd.c b/gpsd.c
index e12785f8..c88ab191 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1003,8 +1003,10 @@ int main(int argc, char *argv[])
}
#ifdef NTPSHM_ENABLE
- (void)nice(-10); /* for precise timekeeping increase priority */
- (void)ntpshm_init(&context, nowait);
+ if (getuid() == 0) {
+ (void)nice(-10); /* for precise timekeeping increase priority */
+ (void)ntpshm_init(&context, nowait);
+ }
#endif /* NTPSHM_ENABLE */
/* make default devices accessible even after we drop privileges */