]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/findlib/attribs.c
Update doc
[bacula/bacula] / bacula / src / findlib / attribs.c
index 5471759308925f402482978396b808bee280ef3a..488ed47fdbbef65f7891e8d5dba8dc6fb835a00d 100755 (executable)
@@ -9,7 +9,7 @@
  *
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -45,6 +45,10 @@ extern "C" HANDLE get_osfhandle(int fd);
 void win_error(void *jcr, char *prefix, POOLMEM *ofile);
 #endif
 
+/* For old systems that don't have lchown() use chown() */
+#ifndef HAVE_LCHOWN
+#define lchown chown
+#endif
 
 /*=============================================================*/
 /*                                                            */
@@ -54,7 +58,7 @@ void win_error(void *jcr, char *prefix, POOLMEM *ofile);
 
 
 /* Encode a stat structure into a base64 character string */
-void encode_stat(char *buf, struct stat *statp)
+void encode_stat(char *buf, struct stat *statp, uint32_t LinkFI)
 {
    char *p = buf;
    /*
@@ -89,6 +93,8 @@ void encode_stat(char *buf, struct stat *statp)
    p += to_base64((int64_t)statp->st_mtime, p);
    *p++ = ' ';
    p += to_base64((int64_t)statp->st_ctime, p);
+   *p++ = ' ';
+   p += to_base64((int64_t)LinkFI, p);
    *p = 0;
    return;
 }
@@ -97,7 +103,7 @@ void encode_stat(char *buf, struct stat *statp)
 
 /* Decode a stat packet from base64 characters */
 void
-decode_stat(char *buf, struct stat *statp)
+decode_stat(char *buf, struct stat *statp, uint32_t *LinkFI) 
 {
    char *p = buf;
    int64_t val;
@@ -140,6 +146,14 @@ decode_stat(char *buf, struct stat *statp)
    p++;
    p += from_base64(&val, p);
    statp->st_ctime = val;
+   /* Optional FileIndex of hard linked file data */
+   if (*p == ' ' || (*p != 0 && *(p+1) == ' ')) {
+      p++;
+      p += from_base64(&val, p);
+      *LinkFI = (uint32_t)val;
+  } else {
+      *LinkFI = 0;
+  }
 }
 
 /*
@@ -402,8 +416,8 @@ extern "C" void cygwin_conv_to_win32_path(const char *path, char *win32_path);
 
 void unix_name_to_win32(POOLMEM **win32_name, char *name)
 {
-   /* One extra byte should suffice, but we take 10 */
-   *win32_name = check_pool_memory_size(*win32_name, strlen(name)+10);
+   /* One extra byte should suffice, but we double it */
+   *win32_name = check_pool_memory_size(*win32_name, 2*strlen(name)+1);
    cygwin_conv_to_win32_path(name, *win32_name);
 }