]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/adouble/ad_size.c
Conversion from adouble v2 to ea for directories
[netatalk.git] / libatalk / adouble / ad_size.c
index 83e6df7beef48474c6a2146766fee79ffc3c8228..6b4ed96d40a9fd09a8173becbce1d28dca3d43f6 100644 (file)
@@ -1,5 +1,4 @@
 /*
- * $Id: ad_size.c,v 1.4 2002-01-04 04:45:48 sibaz Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <string.h>
 #include <atalk/logger.h>
-
 #include <atalk/adouble.h>
 
-off_t ad_size(const struct adouble *ad, const u_int32_t eid)
+off_t ad_size(const struct adouble *ad, const uint32_t eid)
 {
   if (eid == ADEID_DFORK) {
     struct stat st;
-    
-    if (fstat(ad_dfileno(ad), &st) < 0)
+
+    if (ad->ad_data_fork.adf_syml) 
+        return strlen(ad->ad_data_fork.adf_syml);
+
+    if (fstat(ad_data_fileno(ad), &st) < 0)
       return 0;
     return st.st_size;
   }  
-
+#if 0
   return ad_getentrylen(ad, eid);
+#endif
+  return ad->ad_rlen;  
 }