LCOV - code coverage report
Current view: top level - src/server/protocol1 - fdirs.c (source / functions) Hit Total Coverage
Test: burp-coverage-clean.info Lines: 33 34 97.1 %
Date: 2016-07-02 Functions: 4 4 100.0 %

          Line data    Source code
       1             : #include "../../burp.h"
       2             : #include "fdirs.h"
       3             : #include "../../alloc.h"
       4             : #include "../../prepend.h"
       5             : 
       6           5 : struct fdirs *fdirs_alloc(void)
       7             : {
       8           5 :         return (struct fdirs *)calloc_w(1, sizeof(struct fdirs), __func__);
       9             : }
      10             : 
      11           5 : int fdirs_init(struct fdirs *fdirs,
      12             :         struct sdirs *sdirs, const char *realcurrent)
      13             : {
      14          10 :         if((fdirs->datadir=prepend_s(sdirs->finishing, "data"))
      15           5 :          && (fdirs->datadirtmp=prepend_s(sdirs->finishing, "data.tmp"))
      16           5 :          && (fdirs->manifest=prepend_s(sdirs->finishing, "manifest.gz"))
      17           5 :          && (fdirs->deletionsfile=prepend_s(sdirs->finishing, "deletions"))
      18           5 :          && (fdirs->currentdup=prepend_s(sdirs->finishing, "currentdup"))
      19           5 :          && (fdirs->currentduptmp=prepend_s(sdirs->finishing, "currentdup.tmp"))
      20           5 :          && (fdirs->currentdupdata=prepend_s(fdirs->currentdup, "data"))
      21           5 :          && (fdirs->timestamp=prepend_s(sdirs->finishing, "timestamp"))
      22           5 :          && (fdirs->fullrealcurrent=prepend_s(sdirs->client, realcurrent))
      23           5 :          && (fdirs->logpath=prepend_s(sdirs->finishing, "log"))
      24           5 :          && (fdirs->hlinked=prepend_s(sdirs->finishing, "hardlinked"))
      25          10 :          && (fdirs->hlinkedcurrent=prepend_s(sdirs->current, "hardlinked")))
      26             :         {
      27             :                 return 0;
      28             :         }
      29           0 :         return -1;
      30             : }
      31             : 
      32           5 : static void fdirs_free_content(struct fdirs *fdirs)
      33             : {
      34          10 :         if(!fdirs) return;
      35           5 :         free_w(&fdirs->datadir);
      36           5 :         free_w(&fdirs->datadirtmp);
      37           5 :         free_w(&fdirs->manifest);
      38           5 :         free_w(&fdirs->deletionsfile);
      39           5 :         free_w(&fdirs->currentdup);
      40           5 :         free_w(&fdirs->currentduptmp);
      41           5 :         free_w(&fdirs->currentdupdata);
      42           5 :         free_w(&fdirs->timestamp);
      43           5 :         free_w(&fdirs->fullrealcurrent);
      44           5 :         free_w(&fdirs->logpath);
      45           5 :         free_w(&fdirs->hlinked);
      46           5 :         free_w(&fdirs->hlinkedcurrent);
      47             : }
      48             : 
      49           5 : void fdirs_free(struct fdirs **fdirs)
      50             : {
      51          10 :         if(!fdirs || !*fdirs) return;
      52           5 :         fdirs_free_content(*fdirs);
      53           5 :         free_v((void **)fdirs);
      54             : }

Generated by: LCOV version 1.10