pm

barely a pack manager
git clone git://z3bra.org/pm
Log | Files | Refs | README | LICENSE

commit 3520ebda244371812dd12b04da00df4fc986df18
parent 505bcbe3ef7f29ac3f26f7d0b0f678a7efe53d55
Author: z3bra <willyatmailoodotorg>
Date:   Thu Jan  7 14:58:21 2016

Don't attempt to remove non existing files

Diffstat:
 pm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pm.c b/pm.c @@ -1,3 +1,4 @@ +#include <errno.h> #include <dirent.h> #include <fcntl.h> #include <limits.h> @@ -365,7 +366,10 @@ delete_content(FILE *f) len--; } - stat(file, &st); + /* if file doesn't exist anymore, it's all good :) */ + if (stat(file, &st) < 0 && errno == ENOENT) + return 0; + if (S_ISDIR(st.st_mode) && is_empty(file)) return rmdir(file);