[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH v4 3/9] loop:refactor: del close_and_try_next_loopN
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2022-12-12 18:09:55
Message-ID: CAK1hOcMCPNpy_3incE_vSZ1=s4MQFuqB+nPY=GPeZAqBGiNk2w () mail ! gmail ! com
[Download RAW message or body]

On Mon, Nov 21, 2022 at 2:57 PM Xiaoming Ni <nixiaoming@huawei.com> wrote:
>
> Step 3 of micro-refactoring the set_loop() function:
>         Delete close_and_try_next_loopN.
>
> (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0)                 Total: 0 bytes
>
> Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
> ---
>  libbb/loop.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libbb/loop.c b/libbb/loop.c
> index 6c28e683a..c7687052b 100644
> --- a/libbb/loop.c
> +++ b/libbb/loop.c
> @@ -200,13 +200,14 @@ int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offse
>                 if (rc && errno == ENXIO) {
>                         /* Associate free loop device with file */
>                         if (ioctl(lfd, LOOP_SET_FD, ffd)) {
> +                               close(lfd);
>                                 /* Ouch. Are we racing with other mount? */
>                                 if (!*device) {
> -                                       close(lfd);
>  //TODO: add "if (--failcount != 0) ..."?
>                                         continue;
> +                               } else {
> +                                       break;
>                                 }
> -                               goto close_and_try_next_loopN;
>                         }

 if (ioctl(lfd, LOOP_SET_FD, ffd))
                               goto close_and_try_next_loopN;

will work as well: the code at that label checks for
"if (!*device)" case too.

Applied, thank you.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic