Append \n to error messages to make them readable, regardless of circumstances

This commit is contained in:
Michael Stapelberg 2009-01-25 21:00:49 +01:00
parent 5bdb2a95df
commit 851dad9655

View File

@ -296,7 +296,7 @@ static char *get_wireless_info() {
memset(part, 0, sizeof(part)); memset(part, 0, sizeof(part));
if ((fd = open("/proc/net/wireless", O_RDONLY)) == -1) if ((fd = open("/proc/net/wireless", O_RDONLY)) == -1)
die("Could not open /proc/net/wireless"); die("Could not open /proc/net/wireless\n");
(void)read(fd, buf, sizeof(buf)); (void)read(fd, buf, sizeof(buf));
(void)close(fd); (void)close(fd);
@ -396,7 +396,7 @@ static bool process_runs(const char *path) {
memset(pidbuf, 0, sizeof(pidbuf)); memset(pidbuf, 0, sizeof(pidbuf));
if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0)
die("glob() failed"); die("glob() failed\n");
fd = open((globbuf.gl_pathc > 0 ? globbuf.gl_pathv[0] : path), O_RDONLY); fd = open((globbuf.gl_pathc > 0 ? globbuf.gl_pathv[0] : path), O_RDONLY);
globfree(&globbuf); globfree(&globbuf);
if (fd < 0) if (fd < 0)
@ -437,7 +437,7 @@ int main(int argc, char *argv[]) {
setup(); setup();
if ((general_socket = socket(AF_INET, SOCK_DGRAM, 0)) == -1) if ((general_socket = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
die("Could not create socket"); die("Could not create socket\n");
while (1) { while (1) {
for (i = 0; i < num_run_watches; i += 2) { for (i = 0; i < num_run_watches; i += 2) {
@ -463,7 +463,7 @@ int main(int argc, char *argv[]) {
/* Get load */ /* Get load */
if ((load_avg = open("/proc/loadavg", O_RDONLY)) == -1) if ((load_avg = open("/proc/loadavg", O_RDONLY)) == -1)
die("Could not open /proc/loadavg"); die("Could not open /proc/loadavg\n");
(void)read(load_avg, part, sizeof(part)); (void)read(load_avg, part, sizeof(part));
(void)close(load_avg); (void)close(load_avg);
*skip_character(part, ' ', 3) = '\0'; *skip_character(part, ' ', 3) = '\0';