misc_test.c : Force errno to zero at start of some tests.

This commit is contained in:
Erik de Castro Lopo 2006-11-19 12:22:45 +11:00
parent 7a667e179a
commit 6ca8632158

View File

@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <math.h>
@ -235,6 +236,9 @@ filesystem_full_test (int typemajor)
return ;
#endif
/* Make sure errno is zero before doing anything else. */
errno = 0 ;
print_test_name ("filesystem_full_test", filename) ;
if (stat (filename, &buf) != 0)
@ -287,6 +291,9 @@ permission_test (const char *filename, int typemajor)
const char *errorstr ;
int frames ;
/* Make sure errno is zero before doing anything else. */
errno = 0 ;
if (getuid () == 0)
{ /* If running as root bypass this test.
** Root is allowed to open a readonly file for write.