On 10/26/2010 08:34 AM, Christian Weisgerber wrote:
The gnu/fdopendir.c included with GNU tar 1.24 won't compile with a C89
compiler because it puts a declaration in between statements.
--- gnu/fdopendir.c.orig Tue Oct 26 06:54:19 2010
+++ gnu/fdopendir.c Tue Oct 26 06:54:52 2010
@@ -116,6 +116,7 @@ fdopendir_with_dup (int fd, int older_dupfd)
static DIR *
fd_clone_opendir (int fd)
{
+ struct saved_cwd saved_cwd;
Thanks for the report. However, your proposed patch causes a
compilation warning about an unused variable if REPLACE_FCHDIR is defined.
I'm pushing this in your name instead:
diff --git i/lib/fdopendir.c w/lib/fdopendir.c
index 59826ae..4d2935f 100644
--- i/lib/fdopendir.c
+++ w/lib/fdopendir.c
@@ -142,6 +142,7 @@ fd_clone_opendir (int fd)
# else /* !REPLACE_FCHDIR */
/* Occupy the destination FD slot, so that save_cwd cannot
hijack it. */
+ struct saved_cwd saved_cwd;
int fd_reserve = dup (fd);
if (fd_reserve < 0)
{
@@ -150,7 +151,6 @@ fd_clone_opendir (int fd)
goto fail;
}
- struct saved_cwd saved_cwd;
if (save_cwd (&saved_cwd) != 0)
openat_save_fail (errno);
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org