RE: [PATCH pynfs] rpc.py: Don't try to subscript an exception.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks. I have this patch in my repo and keep not getting around to submitting it.

Frank

> -----Original Message-----
> From: NeilBrown [mailto:neilb@xxxxxxx]
> Sent: Monday, March 27, 2023 5:49 PM
> To: Bruce Fields <bfields@xxxxxxxxxxxx>; Jeff Layton <jlayton@xxxxxxxxxx>
> Cc: Linux NFS Mailing List <linux-nfs@xxxxxxxxxxxxxxx>
> Subject: [PATCH pynfs] rpc.py: Don't try to subscript an exception.
> 
> 
> As far as I can tell python3 has never supported subscripting of exceptions.
> So don't try to...
> 
> Signed-off-by: NeilBrown <neilb@xxxxxxx>
> ---
>  nfs4.0/lib/rpc/rpc.py | 2 +-
>  rpc/rpc.py            | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py index
> 24a7fc72eff0..585db3551f73 100644
> --- a/nfs4.0/lib/rpc/rpc.py
> +++ b/nfs4.0/lib/rpc/rpc.py
> @@ -227,7 +227,7 @@ class RPCClient(object):
>                  sock.bind(('', port))
>                  return
>              except socket.error as why:
> -                if why[0] == errno.EADDRINUSE:
> +                if why.errno == errno.EADDRINUSE:
>                      port += 1
>                  else:
>                      print("Could not use low port") diff --git a/rpc/rpc.py b/rpc/rpc.py
> index 1fe285aa2b5b..814de4e08bc9 100644
> --- a/rpc/rpc.py
> +++ b/rpc/rpc.py
> @@ -846,7 +846,7 @@ class ConnectionHandler(object):
>                  s.bind(('', using))
>                  return
>              except socket.error as why:
> -                if why[0] == errno.EADDRINUSE:
> +                if why.errno == errno.EADDRINUSE:
>                      using += 1
>                      if port < 1024 <= using:
>                          # If we ask for a secure port, make sure we don't
> --
> 2.40.0





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux