bug-coreutils
[Top][All Lists]
Advanced

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

[PATCH] tests: CuTmpdir.pm: avoid use of undefined variable in warning


From: Jim Meyering
Subject: [PATCH] tests: CuTmpdir.pm: avoid use of undefined variable in warning
Date: Wed, 25 Mar 2009 10:30:01 +0100

Thanks, Ralf!
I've applied this:

>From 26559b513dd51a8adb941829b46c162d90434f7d Mon Sep 17 00:00:00 2001
From: Ralf Wildenhues <address@hidden>
Date: Wed, 25 Mar 2009 10:15:46 +0100
Subject: [PATCH] tests: CuTmpdir.pm: avoid use of undefined variable in warning

* tests/CuTmpdir.pm (chmod_tree): Do not warn if $dir is undefined.
---
 tests/CuTmpdir.pm |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/CuTmpdir.pm b/tests/CuTmpdir.pm
index 166e50b..1e52640 100644
--- a/tests/CuTmpdir.pm
+++ b/tests/CuTmpdir.pm
@@ -1,7 +1,7 @@
 package CuTmpdir;
 # create, then chdir into a temporary sub-directory

-# Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -45,7 +45,11 @@ sub chmod_1

 sub chmod_tree
 {
-  if (defined $dir && chdir $dir)
+  # When tempdir fails, it croaks, which leaves $dir undefined.
+  defined $dir
+    or return;
+
+  if (chdir $dir)
     {
       # Perform the equivalent of find . -type d -print0|xargs -0 chmod -R 700.
       my $options = {untaint => 1, wanted => \&chmod_1};
--
1.6.2.rc1.285.gc5f54




reply via email to

[Prev in Thread] Current Thread [Next in Thread]