/*
- * $Id: ofork.c,v 1.20.6.6.2.2 2005-02-10 01:23:15 didg Exp $
+ * $Id: ofork.c,v 1.20.6.6.2.3 2005-07-21 17:00:09 didg Exp $
*
* Copyright (c) 1996 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
of = oforks[of_refnum];
+ /* here's the deal: we allocate enough for the standard mac file length.
+ * in the future, we'll reallocate in fairly large jumps in case
+ * of long unicode names */
+ of->of_namelen = 255 +1;
+ if (( of->of_name =(char *)malloc( of->of_namelen )) == NULL ) {
+ LOG(log_error, logtype_afpd, "of_alloc: malloc: %s", strerror(errno) );
+ free(of);
+ oforks[ of_refnum ] = NULL;
+ return NULL;
+ }
+
/* see if we need to allocate space for the adouble struct */
if (!ad) {
ad = malloc( sizeof( struct adouble ) );
if (!ad) {
LOG(log_error, logtype_afpd, "of_alloc: malloc: %s", strerror(errno) );
+ free(of->of_name);
+ free(of);
+ oforks[ of_refnum ] = NULL;
return NULL;
}
}
of->of_ad = ad;
-
of->of_vol = vol;
of->of_dir = dir;
d_ofork->of_d_prev = of;
}
- /* here's the deal: we allocate enough for the standard mac file length.
- * in the future, we'll reallocate in fairly large jumps in case
- * of long unicode names */
- if (( of->of_name =(char *)malloc(255 + 1)) == NULL ) {
- LOG(log_error, logtype_afpd, "of_alloc: malloc: %s", strerror(errno) );
- if (!ad)
- free(of->of_ad);
- free(of);
- oforks[ of_refnum ] = NULL;
- return NULL;
- }
- strlcpy( of->of_name, path, of->of_namelen = 255 + 1);
+ strlcpy( of->of_name, path, of->of_namelen);
*ofrefnum = refnum;
of->of_refnum = refnum;
of->key.dev = st->st_dev;