]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
fix ifdef logic in fs_get_free_space()
authorAlain Spineux <alain@baculasystems.com>
Mon, 26 Jun 2023 09:45:32 +0000 (11:45 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
- this
#if defined(HAVE_WIN32)
#elif defined(HAVE_SYS_STATVFS_H) || !defined(HAVE_WIN32)
#endif
  is equivalent to
#if defined(HAVE_WIN32)
#else
#endif
  as the HAVE_WIN32 are in the if and the elif
- there is no reason to "care" about "statvfs()" as the fallback is to use
  statfs (see the line above, that I reproduce here):
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#else
#define statvfs statfs
#endif
- the other commits related to this piece of code are
c8d10999f1789b88f9f93d29b512e7af10fd009d
33b01b743fa5629828f61fa1300234785c999afa
db82b457bf1dede1225a53c37e60d2d30af84b3b

bacula/src/lib/bsys.c

index 549ec317b4bb415891d366a80a71f7573257bea9..1211fb1c96c36c6080efe5d3703bd22406b6838b 100644 (file)
@@ -1305,11 +1305,8 @@ int fs_get_free_space(const char *path, int64_t *freeval, int64_t *totalval)
    BOOL ret = GetDiskFreeSpaceExA(path, NULL, (PULARGE_INTEGER)totalval, (PULARGE_INTEGER)freeval);
    if (ret) {
       return 0;
-   } else {
-      return -1;
    }
-
-#elif defined(HAVE_SYS_STATVFS_H) || !defined(HAVE_WIN32)
+#else
    struct statvfs st;
 
    if (statvfs(path, &st) == 0) {