File: log_unlink.c

package info (click to toggle)
leafnode 1.12.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,496 kB
  • sloc: ansic: 10,961; sh: 1,709; xml: 627; makefile: 259; perl: 84; sed: 4
file content (25 lines) | stat: -rw-r--r-- 469 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* (C) 2001 - 2010 by Matthias Andree */

#include "leafnode.h"
#include <unistd.h>

#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif

#include "ln_log.h"

int
log_unlink(const char *f, int ignore_enoent)
{
    int r = unlink(f);
    if (r < 0 && errno == ENOENT && ignore_enoent)
	r = 0;
    if (r < 0)
	ln_log(LNLOG_SERR, LNLOG_CTOP, "cannot unlink %s: %m", f);
    else {
	if (debugmode)
	    ln_log(LNLOG_SDEBUG, LNLOG_CTOP, "unlinked %s", f);
    }
    return r;
}