]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/file.c
afp_createfile initalize of pointer before use help :(
[netatalk.git] / etc / afpd / file.c
index dcbc9b10fc03b0e79e9135c91631ea590624dad4..02a7f9f832499ada219b2bc432c0b104f2f05a80 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.55 2002-09-05 14:52:05 didg Exp $
+ * $Id: file.c,v 1.59 2002-09-11 03:03:27 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -424,7 +424,7 @@ int         ibuflen, *rbuflen;
     struct adouble     ad, *adp;
     struct vol         *vol;
     struct dir         *dir;
-    struct ofork        *of;
+    struct ofork        *of = NULL;
     char               *path, *upath;
     int                        creatf, did, openf, retvalue = AFP_OK;
     u_int16_t          vid;
@@ -933,13 +933,13 @@ int               ibuflen, *rbuflen;
      *      and locks need to stay coherent. as a result,
      *      we just balk if the file is opened already. */
 
+    newname = obj->newtmp;
+    strcpy( newname, path );
+
     upath = mtoupath(vol, newname );
     if (of_findname(upath, NULL))
         return AFPERR_DENYCONF;
 
-    newname = obj->newtmp;
-    strcpy( newname, path );
-
     p = ctoupath( vol, curdir, newname );
 #ifdef FORCE_UIDGID
     /* FIXME svid != dvid && dvid's user can't read svid */
@@ -976,20 +976,19 @@ int               ibuflen, *rbuflen;
             return( AFPERR_PARAM );
         }
     }
-
-    if ( (err = copyfile(p, upath, newname,
-                         vol_noadouble(vol))) < 0 ) {
+    upath = mtoupath(vol, newname);
+    if ( (err = copyfile(p, upath , newname, vol_noadouble(vol))) < 0 ) {
         return err;
     }
 
-    setvoltime(obj, vol );
-
 #ifdef DROPKLUDGE
     if (vol->v_flags & AFPVOL_DROPBOX) {
-        retvalue=matchfile2dirperms(newname, vol, sdid);
+        retvalue=matchfile2dirperms(upath, vol, ddid); /* FIXME sdir or ddid */
     }
 #endif /* DROPKLUDGE */
 
+    setvoltime(obj, vol );
+
 #ifdef DEBUG
     LOG(log_info, logtype_afpd, "end afp_copyfile:");
 #endif /* DEBUG */
@@ -1043,13 +1042,13 @@ const int   noadouble;
     char               filebuf[8192];
     int                        sfd, dfd, len, err = AFP_OK;
     ssize_t             cc;
-    char                *dpath;
+    char                dpath[ MAXPATHLEN + 1];
     int                 admode;
 #ifdef DEBUG
     LOG(log_info, logtype_afpd, "begin copyfile:");
 #endif /* DEBUG */
 
-    dpath = ad_path( dst, ADFLAGS_HF );
+    strcpy(dpath, ad_path( dst, ADFLAGS_HF ));
     admode = ad_mode( dst, 0666 );
     if (newname) {
         if ((sfd = open( ad_path( src, ADFLAGS_HF ), O_RDONLY, 0 )) < 0 ) {