From 8e765415a8b7be5e374261f91f4db0ed11a43a9b Mon Sep 17 00:00:00 2001 From: srittau Date: Thu, 7 Feb 2002 23:57:27 +0000 Subject: [PATCH] Trunk-BP: DID fixes. --- etc/afpd/ofork.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/etc/afpd/ofork.c b/etc/afpd/ofork.c index 14adc995..8d33ffee 100644 --- a/etc/afpd/ofork.c +++ b/etc/afpd/ofork.c @@ -1,5 +1,5 @@ /* - * $Id: ofork.c,v 1.5.2.1 2001-12-03 05:01:04 jmarcus Exp $ + * $Id: ofork.c,v 1.5.2.2 2002-02-07 23:57:27 srittau Exp $ * * Copyright (c) 1996 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -152,11 +152,33 @@ struct adouble *ad; return NULL; } - for ( refnum = lastrefnum++, i = 0; i < nforks; i++, refnum++ ) { + for ( refnum = ++lastrefnum, i = 0; i < nforks; i++, refnum++ ) { + /* cf AFP3.0.pdf, File fork page 40 */ + if (!refnum) + refnum++; if ( oforks[ refnum % nforks ] == NULL ) { break; } } + /* grr, Apple and their 'uniquely identifies' + the next line is a protection against + of_alloc() + refnum % nforks = 3 + lastrefnum = 3 + oforks[3] != NULL + refnum = 4 + oforks[4] == NULL + return 4 + + close(oforks[4]) + + of_alloc() + refnum % nforks = 4 + ... + return 4 + same if lastrefnum++ rather than ++lastrefnum. + */ + lastrefnum = refnum; if ( i == nforks ) { syslog(LOG_ERR, "of_alloc: maximum number of forks exceeded."); return( NULL ); -- 2.39.2