Fix temporary file creation in mmapstress tests
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Jiri Palecek
Hello,
these are two little fixes of the mmapstress test.
- the
mkstemp()function returns -1 on error; the tests treat 0 as error instead
Quoted 7 lines
-
mkstemp()returns a file descriptor; no need to open the file once more laterRegards
Jiri PalecekSigned-off-by Jiri Palecek <[email protected]>
Thanks.
Regards--
Subrata
Quoted 43 lines
--- testcases/kernel/mem/mmapstress/mmapstress02.c | 6 +----- testcases/kernel/mem/mmapstress/mmapstress05.c | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-)testcases/kernel/mem/mmapstress/mmapstress02.c +1
-5@@ -101,7 +101,7 @@ main(int argc, char *argv[]) {return 1 ; } (void )time (&t); -if (!(fd =mkstemp (tmpname))) { +if ((fd =mkstemp (tmpname)) ==-1 ) {ERROR ("mkstemp failed" );anyfail (); }@@ -114,10 +114,6 @@ main(int argc, char *argv[]) {CATCH_SIG (SIGINT );CATCH_SIG (SIGQUIT );CATCH_SIG (SIGTERM ); -if ((fd =open (tmpname,O_CREAT |O_RDWR ,0777 )) ==-1 ) { -ERROR ("couldn't open temporary file" ); -anyfail (); - }if (sbrk (2 *pagesize - ((ulong )sbrk (0 ) & (pagesize-1 ))) == (char *)-1 ) {CLEANERROR ("couldn't round up brk" );anyfail ();testcases/kernel/mem/mmapstress/mmapstress05.c +1
-1@@ -133,7 +133,7 @@ main(int argc, char *argv[])-- sreeni */ -if (!(fd =mkstemp (tmpname))) { +if ((fd =mkstemp (tmpname))==-1 ) {ERROR ("mkstemp failed" );anyfail (); }
testcases/kernel/mem/mmapstress/mmapstress05.c main(int argc, char *argv[]) · line 151
Quoted 10 lines
testcases/kernel/mem/mmapstress/mmapstress05.c +0
-4@@ -146,10 +146,6 @@ main(int argc, char *argv[])CATCH_SIG (SIGINT );CATCH_SIG (SIGQUIT );CATCH_SIG (SIGTERM ); -if ((fd =open (tmpname,O_RDWR |O_CREAT ,0777 )) ==-1 ) { -ERROR ("open failed" ); -anyfail (); - }for (i =0 ; i < pagesize; i++) buf[i] ='a' ;if (write (fd, buf, pagesize) != pagesize) {
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list