summaryrefslogtreecommitdiff
path: root/gpsctl.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-02-25 20:02:16 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-02-25 20:02:16 +0000
commit95431d08b2de3a584eedf19cfa9b877b093eda96 (patch)
treee6aff5a5a89526a13ad3f039c2a7b794f5f8567b /gpsctl.c
parent4496cc6f97e2c8fec32d5b6a08f5dc5f962f8438 (diff)
downloadgpsd-95431d08b2de3a584eedf19cfa9b877b093eda96.tar.gz
Set readonly properly for gpsctl -e.
Diffstat (limited to 'gpsctl.c')
-rw-r--r--gpsctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gpsctl.c b/gpsctl.c
index 7c132ad8..f894521d 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -315,6 +315,9 @@ int main(int argc, char **argv)
/*@ -mustfreeonly -immediatetrans @*/
session.context = &context; /* in case gps_init isn't called */
+ if (echo)
+ context.readonly = true;
+
(void) alarm(timeout);
(void) signal(SIGALRM, onsig);
/*
@@ -458,6 +461,8 @@ int main(int argc, char **argv)
}
/*@ -compdef @*/
if (control) {
+ bool write_enable = context.readonly;
+ context.readonly = false;
if (session.device_type->control_send == NULL) {
gpsd_report(LOG_ERROR,
"%s devices have no control sender.\n",
@@ -471,6 +476,7 @@ int main(int argc, char **argv)
status = 1;
}
}
+ context.readonly = write_enable;
}
/*@ +compdef @*/