From 5135e4c1356a14e951ec32cf2dcf68ab3bc6b948 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 11 Feb 2007 13:43:22 +0000 Subject: [PATCH] The check filebase command now also removes dead symlinks from the download directories --- ChangeLog | 5 +++++ mbfido/mbfcheck.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 106e5f8d..14d7370c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ v0.91.3 11-Feb-2007 mbuser: Set default editor on erased records. + mbfile: + The check filebase command now also removes dead symlinks from + the download directories. + + v0.91.2 14-Jan-2007 - 11-Feb-2007 diff --git a/mbfido/mbfcheck.c b/mbfido/mbfcheck.c index 6f703a40..fc3a0b6d 100644 --- a/mbfido/mbfcheck.c +++ b/mbfido/mbfcheck.c @@ -4,7 +4,7 @@ * Purpose: File Database Maintenance - Check filebase * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2007 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -533,7 +533,7 @@ void CheckArea(int Area) (strncmp(de->d_name, "index", 5)) && (strncmp(de->d_name, "readme", 6))) { snprintf(fn, PATH_MAX, "%s/%s", area.Path, de->d_name); - if (stat(fn, &stb) == 0) + if (stat(fn, &stb) == 0) { if (S_ISREG(stb.st_mode)) { if (unlink(fn) == 0) { Syslog('!', "%s not in fdb, deleted from disk", fn); @@ -542,6 +542,15 @@ void CheckArea(int Area) WriteError("$%s not in fdb, cannot delete", fn); } } + } + if (lstat(fn, &stb) == 0) { + if (unlink(fn) == 0) { + Syslog('-', "%s dead link removed from disk", fn); + iErrors++; + } else { + WriteError("$%s link not in fdb, cannot delete", fn); + } + } } } }