summaryrefslogtreecommitdiff
path: root/gpsdctl.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-10-17 07:28:31 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-10-17 07:28:31 -0400
commitea91baeb669d27961717b98da3074e39da5badee (patch)
treefa58d9999fb2c68e2be3e4160f76639a9d42a3e7 /gpsdctl.c
parentfd48fee4c78f49bab10edb1fd10299296cf2e48a (diff)
downloadgpsd-ea91baeb669d27961717b98da3074e39da5badee.tar.gz
Allow gpsdctl to run as non-root.
Diffstat (limited to 'gpsdctl.c')
-rw-r--r--gpsdctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gpsdctl.c b/gpsdctl.c
index 7958c38c..a1ac0844 100644
--- a/gpsdctl.c
+++ b/gpsdctl.c
@@ -21,6 +21,8 @@
#include "gpsd.h"
+#define DEFAULT_GPSD_TEST_SOCKET "/tmp/gpsd.sock"
+
static char *control_socket = DEFAULT_GPSD_SOCKET;
static char *gpsd_options = "";
@@ -97,6 +99,8 @@ int main(int argc, char *argv[])
if (sockenv != NULL)
control_socket = sockenv;
+ else if (geteuid() != 0)
+ control_socket = DEFAULT_GPSD_TEST_SOCKET;
if (optenv != NULL)
gpsd_options = optenv;