summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-10-17 05:39:55 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-10-17 05:39:55 -0400
commit8321b23bb725b098ae1f2220e777dbcfe827d393 (patch)
tree818b775f7fb204bc20ea3dfc32b216e37658c7f1 /gpsd.c
parent96621804887d8f800e535dbbaa6e85a482803fee (diff)
downloadgpsd-8321b23bb725b098ae1f2220e777dbcfe827d393.tar.gz
Prevent a race between KPPS initialization and privilege dropping.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gpsd.c b/gpsd.c
index aeb31a06..c42ad38d 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1984,6 +1984,14 @@ int main(int argc, char *argv[])
}
}
+#if defined(HAVE_SYS_TIMEPPS_H)
+ /*
+ * Wait here until all the thread spawns produced by opening command-line
+ * PPS devices no longer need root privileges.
+ */
+ gpsd_await_pps_initialization()
+#endif /* defined(HAVE_SYS_TIMEPPS_H) */
+
/* drop privileges */
if (getuid() == 0) {
struct passwd *pw;