[netperf-dev] netperf2 commit notice r268 - trunk/src
raj at netperf.org
raj at netperf.org
Tue Mar 18 17:28:02 PDT 2008
Author: raj
Date: 2008-03-18 17:28:01 -0700 (Tue, 18 Mar 2008)
New Revision: 268
Modified:
trunk/src/netlib.c
Log:
mkstemp change from jesse
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2008-03-18 23:14:47 UTC (rev 267)
+++ trunk/src/netlib.c 2008-03-19 00:28:01 UTC (rev 268)
@@ -1597,7 +1597,7 @@
file. 08/2000 */
if (strcmp(fill_file,"") == 0) {
/* use an temp file for the fill file */
- char *temp_file;
+ char temp_file[] = {"netperfXXXXXX\0"};
int *temp_buffer;
/* make sure we have at least an ints worth, even if the user is
@@ -1608,9 +1608,8 @@
if (temp_buffer) {
/* ok, we have the buffer we are going to write, lets get a
temporary filename */
- temp_file = tmpnam(NULL);
- if (NULL != temp_file) {
- fildes = open(temp_file,O_RDWR | O_EXCL | O_CREAT,0600);
+ fildes = mkstemp(temp_file);
+ /* no need to call open because mkstemp did it */
if (-1 != fildes) {
int count;
int *int_ptr;
@@ -1640,14 +1639,9 @@
exit(-1);
}
}
- }
- else {
- perror("allocate_sendfile_buf_ring: could not open tempfile");
- exit(-1);
- }
}
else {
- perror("allocate_sendfile_buf_ring: could not allocate temp name");
+ perror("alloc_sendfile_buf_ring: could not allocate temp name");
exit(-1);
}
}
More information about the netperf-dev
mailing list