aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rc/rc.c')
-rw-r--r--src/rc/rc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 9b4a7e5c..405ea542 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -191,8 +191,10 @@ proc_getent(const char *ent)
}
memset(proc, 0, sizeof(proc));
- fgets(proc, sizeof(proc), fp);
- if (*proc && (p = strstr(proc, ent))) {
+ p = fgets(proc, sizeof(proc), fp);
+ if (p == NULL)
+ eerror("fgets: %s", strerror(errno));
+ else if (*proc && (p = strstr(proc, ent))) {
i = p - proc;
if (i == '\0' || proc[i - 1] == ' ') {
p += strlen(ent);
@@ -234,7 +236,8 @@ read_key(bool block)
termios.c_cc[VTIME] = 0;
}
tcsetattr(fd, TCSANOW, &termios);
- read(fd, &c, 1);
+ if (read(fd, &c, 1) == -1)
+ eerror("read: %s", strerror(errno));
tcsetattr(fd, TCSANOW, termios_orig);
return c;
}
@@ -840,7 +843,8 @@ main(int argc, char **argv)
argv++;
/* Change dir to / to ensure all scripts don't use stuff in pwd */
- chdir("/");
+ if (chdir("/") == -1)
+ eerror("chdir: %s", strerror(errno));
/* Ensure our environment is pure
* Also, add our configuration to it */