public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Carsey, Jaben" <jaben.carsey@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] ShellPkg/rm: fix hang when deleting an absolutely-empty directory An ordinary empty directory should contain "." and ".." entries. When an empty directory even doesn't contain "." or ".." entry, FileHandleFindFirstFile() may return error statu
Date: Thu, 8 Feb 2018 15:21:23 +0000	[thread overview]
Message-ID: <CB6E33457884FA40993F35157061515CA3C55791@FMSMSX103.amr.corp.intel.com> (raw)

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Wednesday, February 07, 2018 7:41 PM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [PATCH] ShellPkg/rm: fix hang when deleting an absolutely-empty
> directory An ordinary empty directory should contain "." and ".." entries.
> When an empty directory even doesn't contain "." or ".." entry,
> FileHandleFindFirstFile() may return error status...
> Importance: High
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> ---
>  ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
> b/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
> index 618610d0f3..288e7666a8 100644
> --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
> +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
> @@ -2,7 +2,7 @@
>    Main file for attrib shell level 2 function.
> 
>    (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
> -  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
>    which accompanies this distribution.  The full text of the license may be
> found at
> @@ -33,6 +33,7 @@ IsDirectoryEmpty (
>    IN EFI_HANDLE   FileHandle
>    )
>  {
> +  EFI_STATUS      Status;
>    EFI_FILE_INFO   *FileInfo;
>    BOOLEAN         NoFile;
>    BOOLEAN         RetVal;
> @@ -41,8 +42,8 @@ IsDirectoryEmpty (
>    NoFile = FALSE;
>    FileInfo = NULL;
> 
> -  for (FileHandleFindFirstFile(FileHandle, &FileInfo)
> -    ;  !NoFile
> +  for (Status = FileHandleFindFirstFile(FileHandle, &FileInfo)
> +    ;  !NoFile && !EFI_ERROR (Status)
>      ;  FileHandleFindNextFile(FileHandle, FileInfo, &NoFile)
>     ){
>      if (StrStr(FileInfo->FileName, L".") != FileInfo->FileName
> --
> 2.16.1.windows.1



                 reply	other threads:[~2018-02-08 15:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CB6E33457884FA40993F35157061515CA3C55791@FMSMSX103.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox