From fb9209248297242c899ac270afa5ad45b2d084f7 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 23 Jul 2013 09:23:32 +0200 Subject: [PATCH] Avoid gcc warning on FreeBSD. FreeBSD 9.1 ships a patched gcc-4.2.1 which complains about use of an initialized variable: fd.c: In function 'for_each_file_in_dir': fd.c:728: warning: 'dir' may be used uninitialized in this function This warning is bogus since para_opendir() only leaves the dir pointer unset on failures. But in this case for_each_file_in_dir() returns early without using the pointer. This commit changes para_opendir() to set dir to NULL before doing anything else. This avoids the warning at almost no cost. --- fd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fd.c b/fd.c index 3ab5cad0..4d4a859b 100644 --- a/fd.c +++ b/fd.c @@ -526,6 +526,7 @@ static int para_opendir(const char *dirname, DIR **dir, int *cwd) { int ret; + *dir = NULL; if (cwd) { ret = para_open(".", O_RDONLY, 0); if (ret < 0) -- 2.39.2