From owner-p4-projects@FreeBSD.ORG Fri Oct 27 23:51:24 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AA28516A412; Fri, 27 Oct 2006 23:51:23 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7FF0E16A407 for ; Fri, 27 Oct 2006 23:51:23 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id CB03D43D49 for ; Fri, 27 Oct 2006 23:51:22 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9RNpMBQ062723 for ; Fri, 27 Oct 2006 23:51:22 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9RNpMG4062718 for perforce@freebsd.org; Fri, 27 Oct 2006 23:51:22 GMT (envelope-from marcel@freebsd.org) Date: Fri, 27 Oct 2006 23:51:22 GMT Message-Id: <200610272351.k9RNpMG4062718@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Cc: Subject: PERFORCE change 108581 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2006 23:51:24 -0000 http://perforce.freebsd.org/chv.cgi?CH=108581 Change 108581 by marcel@marcel_cluster on 2006/10/27 23:50:59 Fix efifs_readdir(): o The Read() function returns success at EOF, but returns a size of 0. o Determine d_namlen based on how many characters we copied. Affected files ... .. //depot/projects/ia64/sys/boot/efi/libefi/efifs.c#11 edit Differences ... ==== //depot/projects/ia64/sys/boot/efi/libefi/efifs.c#11 (text+ko) ==== @@ -43,7 +43,7 @@ union fileinfo { EFI_FILE_INFO info; - char bytes[sizeof(EFI_FILE_INFO) + 510]; + char bytes[sizeof(EFI_FILE_INFO) + 508]; }; static EFI_GUID sfs_guid = SIMPLE_FILE_SYSTEM_PROTOCOL; @@ -299,6 +299,8 @@ status = file->Read(file, &sz, &fi); if (EFI_ERROR(status)) return (status_to_errno(status)); + if (sz == 0) + return (ENOENT); d->d_fileno = 0; d->d_reclen = sizeof(*d); @@ -306,10 +308,10 @@ d->d_type = DT_DIR; else d->d_type = DT_REG; - d->d_namlen = (fi.info.Size - sizeof(EFI_FILE_INFO)) / sizeof(CHAR16); - for (i = 0; i < d->d_namlen; i++) + for (i = 0; fi.info.FileName[i] != 0; i++) d->d_name[i] = fi.info.FileName[i]; d->d_name[i] = 0; + d->d_namlen = i; return (0); }