aboutsummaryrefslogtreecommitdiff
path: root/sway/main.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-12-17 13:23:44 -0500
committerGitHub <noreply@github.com>2016-12-17 13:23:44 -0500
commitf04ee0e68d885d7e1101cc88f9a9337202041f1f (patch)
treefa4dc296a5f1377867752d320ceef4e4b0178bbf /sway/main.c
parent6c0fc2093641868df28c4087902a040f7fae05d4 (diff)
parentd859f825d3612492678f5cd6cc6dc1f2647929e1 (diff)
Merge pull request #995 from SirCmpwn/memory-use
Handle allocation failures
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sway/main.c b/sway/main.c
index 157c61b3..d41eb292 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -53,7 +53,10 @@ void detect_proprietary() {
return;
}
while (!feof(f)) {
- char *line = read_line(f);
+ char *line;
+ if (!(line = read_line(f))) {
+ break;
+ }
if (strstr(line, "nvidia")) {
fprintf(stderr, "\x1B[1;31mWarning: Proprietary nvidia drivers do NOT support Wayland. Use nouveau.\x1B[0m\n");
fprintf(stderr, "\x1B[1;31mYes, they STILL don't work with the newly announced wayland \"support\".\x1B[0m\n");
@@ -118,7 +121,10 @@ static void log_distro() {
if (f) {
sway_log(L_INFO, "Contents of %s:", paths[i]);
while (!feof(f)) {
- char *line = read_line(f);
+ char *line;
+ if (!(line = read_line(f))) {
+ break;
+ }
if (*line) {
sway_log(L_INFO, "%s", line);
}
@@ -136,7 +142,10 @@ static void log_kernel() {
return;
}
while (!feof(f)) {
- char *line = read_line(f);
+ char *line;
+ if (!(line = read_line(f))) {
+ break;
+ }
if (*line) {
sway_log(L_INFO, "%s", line);
}