]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
implement fs_get_free_space for win32
authornorbert.bizet <norbert.bizet@baculasystems.com>
Wed, 5 Apr 2023 16:13:25 +0000 (12:13 -0400)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
bacula/src/lib/bsys.c

index 45ccf210b7f084143b2d1c2cfc730f9ba5e5614f..4c1b848cb34af6e8310a24a16f6cac0c60f205bc 100644 (file)
@@ -1301,7 +1301,15 @@ void gdb_print_local(int level) {}
 
 int fs_get_free_space(const char *path, int64_t *freeval, int64_t *totalval)
 {
-#if defined(HAVE_SYS_STATVFS_H) || !defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
+   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)
    struct statvfs st;
 
    if (statvfs(path, &st) == 0) {