rm_rf_tmp.c (380B)
1 /* ISC license. */ 2 3 #include <skalibs/stralloc.h> 4 #include <skalibs/djbunix.h> 5 6 int rm_rf_tmp (char const *filename, stralloc *tmp) 7 { 8 size_t tmpbase = tmp->len ; 9 if (!stralloc_cats(tmp, filename)) return -1 ; 10 if (!stralloc_0(tmp)) goto err ; 11 if (rm_rf_in_tmp(tmp, tmpbase) == -1) goto err ; 12 tmp->len = tmpbase ; 13 return 0 ; 14 15 err: 16 tmp->len = tmpbase ; 17 return -1 ; 18 }