summaryrefslogtreecommitdiff
path: root/src/libunixonacid/dd_cancel.c
blob: 22adf4ec73066cc3a98124e10856da365fa622d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* ISC license. */

#include <errno.h>
#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>
#include <skalibs/unix-transactional.h>

void dd_cancel (dirdescriptor_t_ref dd)
{
  dirdescriptor_t zero = DIRDESCRIPTOR_ZERO ;
  register int e = errno ;
  fd_close(dd->fd) ;
  rm_rf_in_tmp(&dd->new, 0) ;
  stralloc_free(&dd->new) ;
  *dd = zero ;
  errno = e ;
}