[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tar-1.24/gnulib: fdopendir.c C89 error
From: |
Eric Blake |
Subject: |
Re: tar-1.24/gnulib: fdopendir.c C89 error |
Date: |
Tue, 26 Oct 2010 08:50:49 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4 |
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 address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org