summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-08-11 19:03:39 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-08-11 19:03:39 -0400
commita3d56651f5e902554440342062538bfa0d36b4a6 (patch)
treee48af9af55517041e11d12240ad39f4320b2f91f /gpsd.c
parent3d4b69634bde2c779ea33d81185859b1b76f28c7 (diff)
downloadgpsd-a3d56651f5e902554440342062538bfa0d36b4a6.tar.gz
Revert to old -N behavior of dripping privileges, and explain why.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gpsd.c b/gpsd.c
index 97a79530..82c42052 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1989,8 +1989,16 @@ int main(int argc, char *argv[])
gpsd_report(LOG_PROG, "shared-segment creation succeeded,\n");
#endif /* SHM_EXPORT_ENABLE */
- /* drop privileges */
- if (getuid() == 0) {
+ /*
+ * Drop privileges.
+ *
+ * Yes, the test for this is non-orthogonal and ugly. The problem
+ * is that there are two calls in the PPS support, way later on,
+ * that require root (see ntpmshm.c and look for "requires
+ * root"). We've overloaded -N with the meaning "don't drop
+ * privileges" pending a better solution.
+ */
+ if (getuid() == 0 && go_background) {
struct passwd *pw;
struct stat stb;