xfs
[Top] [All Lists]

[PATCH 3/8] xfstests: Don't use tempnam in growfiles.c

To: xfs@xxxxxxxxxxx
Subject: [PATCH 3/8] xfstests: Don't use tempnam in growfiles.c
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 20 Jan 2010 14:38:03 +1100
In-reply-to: <1263958688-435-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1263958688-435-1-git-send-email-david@xxxxxxxxxxxxx>
tempnam() generates a compiler warning as a dangerous function.
This code doesn't care about security issues with tempnam, so
remove it and just manually build the filenames without the
randomness of tempnam.

Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx>
---
 ltp/growfiles.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/ltp/growfiles.c b/ltp/growfiles.c
index a987b5a..52c9079 100644
--- a/ltp/growfiles.c
+++ b/ltp/growfiles.c
@@ -1162,10 +1162,9 @@ no whole file checking will be performed!\n", Progname, 
TagName, (int)getpid());
        /*
         * construct auto filename and insert them into filenames space
         */
-               
        for(ind=0;ind<num_auto_files; ind++, num++) {
-               sprintf((char *)filenames+(num*PATH_MAX), "%s.%d",
-                       tempnam(auto_dir, auto_file), ind );
+               sprintf((char *)filenames+(num*PATH_MAX), "%s/%s.%d",
+                       auto_dir, auto_file, ind);
        }
 
        /*
-- 
1.6.5

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