]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/appl.c
Fix regression introduced by previous IPC fds fix
[netatalk.git] / etc / afpd / appl.c
index d7e72f2395a5e78c9821d83160342eb11fde090b..78b7587d8b829c7c89b4fb6fd828b10aea07a323 100644 (file)
@@ -22,9 +22,9 @@
 #include <atalk/afp.h>
 #include <atalk/bstrlib.h>
 #include <atalk/bstradd.h>
+#include <atalk/globals.h>
 
 #include "volume.h"
-#include "globals.h"
 #include "directory.h"
 #include "file.h"
 #include "desktop.h"
@@ -138,7 +138,7 @@ makemacpath(const struct vol *vol, char *mpath, int mpathlen, struct dir *dir, c
             /* FIXME: pathname too long */
             return NULL;
         }
-        memcpy(p, cfrombstring(dir->d_m_name), blength(dir->d_m_name) + 1);
+        memcpy(p, cfrombstr(dir->d_m_name), blength(dir->d_m_name) + 1);
         if ((dir = dirlookup(vol, dir->d_pdid)) == NULL)
             return NULL;
     }
@@ -250,6 +250,7 @@ int afp_addappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     mpath = obj->newtmp;
     mp = makemacpath( vol, mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
     if (!mp) {
+        close(tfd);
         return AFPERR_PARAM;
     }
     mplen =  mpath + AFPOBJ_TMPSIZ - mp;
@@ -263,6 +264,7 @@ int afp_addappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     memcpy(p, appltag, sizeof( appltag ));
     cc = mpath + AFPOBJ_TMPSIZ - p;
     if ( write( tfd, p, cc ) != cc ) {
+        close(tfd);
         unlink( tempfile );
         return( AFPERR_PARAM );
     }
@@ -333,6 +335,7 @@ int afp_rmvappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     mpath = obj->newtmp;
     mp = makemacpath( vol, mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
     if (!mp) {
+        close(tfd);
         return AFPERR_PARAM ;
     }