diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2008-12-29 22:12:38 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2008-12-29 22:12:38 +0000 |
commit | 24d0602c05ff825565537a853c3f339ec2df6adc (patch) | |
tree | 51b4ea26c153a5ab8ab801c76a8315869e8899c4 /gpsd.c | |
parent | c806659782602b1cef904957d63924f0b167c25e (diff) | |
download | gpsd-24d0602c05ff825565537a853c3f339ec2df6adc.tar.gz |
GCC now gets huffy about unchecked write(2) returns. Fix some of these.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -81,6 +81,12 @@ #define QLEN 5 +/* + * If ntpshm is enabled, we renice the process to this priority level. + * For precise timekeeping increase priority. + */ +#define NICEVAL -10 + #define sub_index(s) (s - subscribers) static fd_set all_fds; @@ -140,7 +146,8 @@ static int daemonize(void) if (setsid() == -1) return -1; - (void)chdir("/"); + if (chdir("/") == -1) + return -1; /*@ -nullpass @*/ if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { (void)dup2(fd, STDIN_FILENO); @@ -1392,7 +1399,9 @@ int main(int argc, char *argv[]) #ifdef NTPSHM_ENABLE if (getuid() == 0) { - (void)nice(-10); /* for precise timekeeping increase priority */ + errno = 0; + if (nice(NICEVAL) != -1 || errno == 0) + gpsd_report (2, "Priority sertting failed.\n"); (void)ntpshm_init(&context, nowait); } else { gpsd_report (2, "Unable to start ntpshm. gpsd must run as root.\n"); |