mirror of
https://git.suckless.org/dwmstatus
synced 2026-07-17 05:55:07 +02:00
Close fd if there was an empty return.
* Not closing will use up all file descriptors over time.
This commit is contained in:
@@ -106,8 +106,10 @@ readfile(char *base, char *file)
|
||||
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;
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
return smprintf("%s", line);
|
||||
|
||||
Reference in New Issue
Block a user