projects
/
dwm-status
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a30f9f5
)
Close fd if there was an empty return.
author
Christoph Lohmann
<20h@r-36.net>
Sun, 29 Jan 2023 11:15:22 +0000
(12:15 +0100)
committer
Christoph Lohmann
<20h@r-36.net>
Sun, 29 Jan 2023 11:15:22 +0000
(12:15 +0100)
* Not closing will use up all file descriptors over time.
dwmstatus.c
patch
|
blob
|
blame
|
history
diff --git
a/dwmstatus.c
b/dwmstatus.c
index
a8cd4ac
..
1b53292
100644
(file)
--- a/
dwmstatus.c
+++ b/
dwmstatus.c
@@
-106,8
+106,10
@@
readfile(char *base, char *file)
if (fd == NULL)
return NULL;
if (fd == NULL)
return NULL;
- if (fgets(line, sizeof(line)-1, fd) == NULL)
+ if (fgets(line, sizeof(line)-1, fd) == NULL) {
+ fclose(fd);
return NULL;
return NULL;
+ }
fclose(fd);
return smprintf("%s", line);
fclose(fd);
return smprintf("%s", line);