2011-11-18 Paul Eggert <eggert@cs.ucla.edu>
+ test-getcwd: disambiguate exit status
+ * tests/test-getcwd.c (test_long_name): Return 0..7.
+ (main): Exit with an unambiguous exit status. The old
+ code yielded a mysterious mixture of two failure codes.
+
fstatat: fix configuration bug on mingw, OpenBSD 4, Solaris 8
* lib/fstatat.c (AT_FUNC_NAME): Use HAVE_FSTAT, not
HAVE_WORKING_FSTATAT_ZERO_FLAG, to decide whether to define
size_t n_chdirs = 0;
if (cwd == NULL)
- return 10;
+ return 1;
cwd_len = initial_cwd_len = strlen (cwd);
if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0)
{
if (! (errno == ERANGE || errno == ENAMETOOLONG || errno == ENOENT))
- fail = 20;
+ fail = 2;
break;
}
c = getcwd (buf, PATH_MAX);
if (!c && errno == ENOENT)
{
- fail = 11;
+ fail = 3;
break;
}
if (c || ! (errno == ERANGE || errno == ENAMETOOLONG))
{
- fail = 21;
+ fail = 4;
break;
}
}
if (! (errno == ERANGE || errno == ENOENT
|| errno == ENAMETOOLONG))
{
- fail = 22;
+ fail = 5;
break;
}
if (AT_FDCWD || errno == ERANGE || errno == ENOENT)
{
- fail = 12;
+ fail = 6;
break;
}
}
if (c && strlen (c) != cwd_len)
{
- fail = 23;
+ fail = 7;
break;
}
++n_chdirs;
int
main (int argc, char **argv)
{
- return test_abort_bug () + test_long_name ();
+ return test_abort_bug () * 8 + test_long_name ();
}