1 /* (C) 2001 - 2002 by Matthias Andree */
2 
3 #include "leafnode.h"
4 #include <unistd.h>
5 
6 #ifdef WITH_DMALLOC
7 #include <dmalloc.h>
8 #endif
9 
10 #include "ln_log.h"
11 
12 int
log_unlink(const char * f,int ignore_enoent)13 log_unlink(const char *f, int ignore_enoent)
14 {
15     int r = unlink(f);
16     if (r < 0 && errno == ENOENT && ignore_enoent)
17 	r = 0;
18     if (r < 0)
19 	ln_log(LNLOG_SERR, LNLOG_CTOP, "cannot unlink %s: %m", f);
20     else {
21 	if (debugmode)
22 	    ln_log(LNLOG_SDEBUG, LNLOG_CTOP, "unlinked %s", f);
23     }
24     return r;
25 }
26