clean up zero-byte logfile on immediate exit
Otherwise, a zero-byte log file stays behind after every call to `i3 --get-socketpath`. Also, replace "return" calls with more explicit "exit" calls. Before: $ ls -ld /tmp/i3* | wc -l; \ repeat 10 i3 --get-socketpath >/dev/null; \ ls -ld /tmp/i3* | wc -l 1 11 Now: $ ls -ld /tmp/i3* | wc -l; \ repeat 10 i3 --get-socketpath >/dev/null; \ ls -ld /tmp/i3* | wc -l 1 1 Signed-off-by: Julius Plenz <julius@plenz.com>
This commit is contained in:
committed by
Michael Stapelberg
parent
da924aae6f
commit
70ec3867fe
@ -67,4 +67,11 @@ void errorlog(char *fmt, ...)
|
||||
void verboselog(char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
/**
|
||||
* Deletes the unused log files. Useful if i3 exits immediately, eg.
|
||||
* because --get-socketpath was called. We don't care for syscall
|
||||
* failures. This function is invoked automatically when exiting.
|
||||
*/
|
||||
void purge_zerobyte_logfile(void);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user