]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/adouble/ad_open.c
if resource fork size is 0 don't assume mode is RW
[netatalk.git] / libatalk / adouble / ad_open.c
index 5b236551acc24ffc6b5aacb079302c03274772ba..024ff16e6e488e155b60db6472664d4ea90d4311 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ad_open.c,v 1.30.6.2 2003-10-17 00:01:12 didg Exp $
+ * $Id: ad_open.c,v 1.30.6.4 2003-12-12 19:34:27 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -230,10 +230,8 @@ static int ad_v1tov2(struct adouble *ad, const char *path)
    *  2) create space for SHORTNAME, AFPFILEI, DID, and PRODOSI
    *  3) move FILEI attributes into AFPFILEI
    *  4) initialize ACCESS field of FILEDATESI.
-   *
-   *  so, we need 4*12 (entry ids) + 12 (shortname) + 4 (afpfilei) +
-   *  4 (did) + 8 (prodosi) = 76 more bytes.  */
-  
+   */
+   
 #define SHIFTDATA (AD_DATASZ2 - AD_DATASZ1)
 
   /* bail if we can't get a lock */
@@ -883,7 +881,7 @@ int ad_open( path, adflags, oflags, mode, ad )
        }
     } else if (fstat(ad->ad_hf.adf_fd, &st) == 0 && st.st_size == 0) {
        /* for 0 length files, treat them as new. */
-       ad->ad_hf.adf_flags = (oflags & ~(O_RDONLY | O_WRONLY)) | O_RDWR | O_TRUNC;
+       ad->ad_hf.adf_flags = hoflags| O_TRUNC;
     } else {
         ad->ad_hf.adf_flags = hoflags;
     }