Introduction
Introduction Statistics Contact Development Disclaimer Help
Close fd if there was an empty return. - dwmstatus - A simple dwm status applic…
git clone git://git.suckless.org/dwmstatus
Log
Files
Refs
LICENSE
---
commit 81cdc8f4a2528374842049c214937349b30fbebc
parent a30f9f5bd1c9c3fcd96b32e3919206df0e9306bf
Author: Christoph Lohmann <[email protected]>
Date: Sun, 29 Jan 2023 12:15:22 +0100
Close fd if there was an empty return.
* Not closing will use up all file descriptors over time.
Diffstat:
M dwmstatus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/dwmstatus.c b/dwmstatus.c
@@ -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);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.