$OpenBSD: patch-etc_afpd_volume_c,v 1.2 2002/07/26 15:12:17 naddy Exp $
--- etc/afpd/volume.c.orig	Sat Feb 16 09:09:31 2002
+++ etc/afpd/volume.c	Wed Jul 24 16:59:53 2002
@@ -1050,7 +1050,7 @@ int 	ibuflen, *rbuflen;
     struct vol		*volume;
     char	*data;
     int			vcnt, len;
-
+    u_int32_t	secs;
 
     if (!volumes)
         load_volumes(obj);
@@ -1090,9 +1090,10 @@ int 	ibuflen, *rbuflen;
         *rbuflen = 0;
         return AFPERR_PARAM;
     }
-    tv.tv_sec = AD_DATE_FROM_UNIX(tv.tv_sec);
-    memcpy(data, &tv.tv_sec, sizeof( u_int32_t));
-    data += sizeof( u_int32_t);
+    secs = tv.tv_sec;
+    secs = htonl(secs);
+    memcpy(data, &secs, sizeof(secs));
+    data += sizeof(secs);
     *data = vcnt;
     return( AFP_OK );
 }
@@ -1177,11 +1178,11 @@ int		ibuflen, *rbuflen;
     bitmap = htons( bitmap );
     memcpy(rbuf, &bitmap, sizeof( bitmap ));
 
-    curdir = volume->v_dir;
     if ( chdir( volume->v_path ) < 0 ) {
         ret = AFPERR_PARAM;
         goto openvol_err;
     }
+    curdir = volume->v_dir;
 
 #ifdef CNID_DB
     if (volume->v_dbpath)
@@ -1231,9 +1232,8 @@ int		ibuflen, *rbuflen;
         }
     }
     if ( ovol != NULL ) {
+	if (chdir(ovol->v_path) == 0) {
         curdir = ovol->v_dir;
-        if ( chdir( ovol->v_path ) < 0 ) {
-            return( AFPERR_PARAM );
         }
     }
 
