xfs
[Top] [All Lists]

Re: [PATCH] xfsdump: fill in missing strerror() call

To: Alex Elder <elder@xxxxxxxxxxx>
Subject: Re: [PATCH] xfsdump: fill in missing strerror() call
From: Nigel Tamplin <ntamplin@xxxxxxxxxxxxxxx>
Date: Thu, 27 Dec 2012 04:19:44 +0000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <50DBC24E.5020308@xxxxxxxxxxx>
References: <50D7A1C2.9000609@xxxxxxxxxxxxxxx> <50DB794F.7010906@xxxxxxxxxxx> <50DBBDAA.2030507@xxxxxxxxxxxxxxx> <50DBC24E.5020308@xxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20121027 Icedove/3.0.11
On 27/12/12 03:36, Alex Elder wrote:
On 12/26/2012 09:16 PM, Nigel Tamplin wrote:
On 26/12/12 22:25, Alex Elder wrote:
Nigel Tamplin reported getting a seg fault in xfsrestore when a path
name was too long.

Based on the surrounding code, I'm sure strerror(errno) was the
intended final argument to this call.  This bug has been there
since the code was first committed.

Signed-off-by: Alex Elder<elder@xxxxxxxxxxx>
Reported-by: Nigel Tamplin<ntamplin@xxxxxxxxxxxxxxx>
---
   restore/content.c |    3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/restore/content.c b/restore/content.c
index edd00ed..4e55a76 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -7799,7 +7799,8 @@ restore_spec( filehdr_t *fhdrp, rv_t *rvp, char
*path )
                         "%s ino %llu %s: %s: discarding\n"),
                         printstr,
                         fhdrp->fh_stat.bs_ino,
-                      path );
+                      path,
+                      strerror( errno ));
                   ( void )close( sockfd );
                   return BOOL_TRUE;
               }


Hi Alex,

You say...
Based on the surrounding code, I'm sure strerror(errno) was the
intended final argument to this call.

I'm not so sure.

The condition is comparing path length to max length, not detecting a
previously failed system call (like the surrounding code)- as such I
don't think the value of errno is relevant and the fix should be the
removal of one of the format specifiers instead of the addition of the
argument.
Next time I'll actually read the code.

Yes, I fully concur with your analysis.

Do you want to submit a patch?  Or do you want me to re-do mine?

                                        -Alex

Can you re-do yours?

Thanks,

Nigel

<Prev in Thread] Current Thread [Next in Thread>