kopia lustrzana https://github.com/FreeSpacenav/spnavcfg
fixed a couple of minor bugs
rodzic
c9aa215c24
commit
4edd00de1c
9
back.c
9
back.c
|
@ -102,13 +102,12 @@ int get_daemon_pid(void)
|
|||
fprintf(stderr, "no spacenav pid file, can't find daemon\n");
|
||||
return -1;
|
||||
}
|
||||
fgets(buf, sizeof buf, fp);
|
||||
fclose(fp);
|
||||
|
||||
if(!isdigit(buf[0])) {
|
||||
fprintf(stderr, "fucked up pidfile, can't find daemon\n");
|
||||
if(!fgets(buf, sizeof buf, fp) || !isdigit(buf[0])) {
|
||||
fprintf(stderr, "corrupted pidfile, can't find the daemon\n");
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
fclose(fp);
|
||||
return atoi(buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ int read_cfg(const char *fname, struct cfg *cfg)
|
|||
}
|
||||
|
||||
} else if(strcmp(key_str, "serial") == 0) {
|
||||
strncpy(cfg->serial_dev, val_str, PATH_MAX);
|
||||
strncpy(cfg->serial_dev, val_str, PATH_MAX - 1);
|
||||
|
||||
} else {
|
||||
fprintf(stderr, "unrecognized config option: %s\n", key_str);
|
||||
|
|
Ładowanie…
Reference in New Issue