"Fossies" - the Fresh Open Source Software Archive

Member "leafnode-1.12.0/log_unlink.c" (28 Dec 2021, 469 Bytes) of package /linux/misc/leafnode-1.12.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "log_unlink.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.11.12_vs_1.12.0.

    1 /* (C) 2001 - 2010 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
   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 }