Clean up tests and do runtime test for max name length
- Remove unused code - Use standard functions declared in common.c - Change tests to do a runtime test for the max name length of a path component (aka NAME_MAX). The actual value might differ from the hard coded NAME_MAX depending on the file system used.
This commit is contained in:
parent
8a73de51f1
commit
27a2afc1e7
22 changed files with 218 additions and 674 deletions
|
@ -15,6 +15,7 @@ int common_test_nr = -1, errct = 0, subtest;
|
||||||
_PROTOTYPE(void cleanup, (void));
|
_PROTOTYPE(void cleanup, (void));
|
||||||
_PROTOTYPE(int does_fs_truncate, (void));
|
_PROTOTYPE(int does_fs_truncate, (void));
|
||||||
_PROTOTYPE(void e, (int n));
|
_PROTOTYPE(void e, (int n));
|
||||||
|
_PROTOTYPE(int name_max, (char *path));
|
||||||
_PROTOTYPE(void quit, (void));
|
_PROTOTYPE(void quit, (void));
|
||||||
_PROTOTYPE(void rm_rf_dir, (int test_nr));
|
_PROTOTYPE(void rm_rf_dir, (int test_nr));
|
||||||
_PROTOTYPE(void rm_rf_ppdir, (int test_nr));
|
_PROTOTYPE(void rm_rf_ppdir, (int test_nr));
|
||||||
|
@ -59,6 +60,14 @@ int does_fs_truncate(void)
|
||||||
return(does_truncate);
|
return(does_truncate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int name_max(char *path)
|
||||||
|
{
|
||||||
|
struct statvfs stvfs;
|
||||||
|
|
||||||
|
if (statvfs(path, &stvfs) != 0) e(7779);
|
||||||
|
return(stvfs.f_namemax);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void rm_rf_dir(test_nr)
|
void rm_rf_dir(test_nr)
|
||||||
int test_nr;
|
int test_nr;
|
||||||
|
|
|
@ -27,22 +27,15 @@
|
||||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||||
|
|
||||||
int errct = 0;
|
#include "common.c"
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
|
||||||
|
|
||||||
_PROTOTYPE(void test20a, (void));
|
_PROTOTYPE(void test20a, (void));
|
||||||
_PROTOTYPE(void test20b, (void));
|
_PROTOTYPE(void test20b, (void));
|
||||||
_PROTOTYPE(void test20c, (void));
|
_PROTOTYPE(void test20c, (void));
|
||||||
_PROTOTYPE(void test20d, (void));
|
_PROTOTYPE(void test20d, (void));
|
||||||
_PROTOTYPE(int do_check, (void));
|
_PROTOTYPE(int do_check, (void));
|
||||||
_PROTOTYPE(void makelongnames, (void));
|
|
||||||
_PROTOTYPE(void e, (int number));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
char executable[1024];
|
char executable[1024];
|
||||||
|
|
||||||
|
@ -60,11 +53,7 @@ int main(int argc, char *argv[])
|
||||||
strcpy(executable, "../");
|
strcpy(executable, "../");
|
||||||
strcat(executable, argv[0]);
|
strcat(executable, argv[0]);
|
||||||
|
|
||||||
printf("Test 20 ");
|
start(20);
|
||||||
fflush(stdout);
|
|
||||||
System("rm -rf DIR_20; mkdir DIR_20");
|
|
||||||
Chdir("DIR_20");
|
|
||||||
makelongnames();
|
|
||||||
superuser = (geteuid() == 0);
|
superuser = (geteuid() == 0);
|
||||||
|
|
||||||
for (i = 0; i < ITERATIONS; i++) {
|
for (i = 0; i < ITERATIONS; i++) {
|
||||||
|
@ -339,57 +328,3 @@ int do_check()
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void makelongnames()
|
|
||||||
{
|
|
||||||
register int i;
|
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
|
||||||
MaxPath[i++] = '.';
|
|
||||||
MaxPath[i] = '/';
|
|
||||||
}
|
|
||||||
MaxPath[PATH_MAX - 1] = '\0';
|
|
||||||
|
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
|
||||||
strcpy(ToLongPath, MaxPath);
|
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
|
||||||
}
|
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* Save in case printf clobbers it. */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d: ", subtest, n, errno);
|
|
||||||
errno = err_num;
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
Chdir("..");
|
|
||||||
System("rm -rf DIR_20");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else if (errct < 10000) {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
printf("errors\n");
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#define ITERATIONS 1
|
#define ITERATIONS 1
|
||||||
#define MAX_ERROR 4
|
#define MAX_ERROR 4
|
||||||
|
|
||||||
int subtest, errct;
|
#include "common.c"
|
||||||
|
|
||||||
_PROTOTYPE(int main, (int argc, char *argv []));
|
_PROTOTYPE(int main, (int argc, char *argv []));
|
||||||
_PROTOTYPE(void test21a, (void));
|
_PROTOTYPE(void test21a, (void));
|
||||||
|
@ -36,8 +36,6 @@ _PROTOTYPE(void test21m, (void));
|
||||||
_PROTOTYPE(void test21n, (void));
|
_PROTOTYPE(void test21n, (void));
|
||||||
_PROTOTYPE(void test21o, (void));
|
_PROTOTYPE(void test21o, (void));
|
||||||
_PROTOTYPE(int get_link, (char *name));
|
_PROTOTYPE(int get_link, (char *name));
|
||||||
_PROTOTYPE(void e, (int n));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
|
@ -50,12 +48,8 @@ char *argv[];
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 21 ");
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
system("rm -rf DIR_21; mkdir DIR_21");
|
|
||||||
chdir("DIR_21");
|
|
||||||
|
|
||||||
|
start(21);
|
||||||
for (i = 0; i < ITERATIONS; i++) {
|
for (i = 0; i < ITERATIONS; i++) {
|
||||||
if (m & 00001) test21a();
|
if (m & 00001) test21a();
|
||||||
if (m & 00002) test21b();
|
if (m & 00002) test21b();
|
||||||
|
@ -73,7 +67,6 @@ char *argv[];
|
||||||
if (m & 020000) test21o();
|
if (m & 020000) test21o();
|
||||||
}
|
}
|
||||||
quit();
|
quit();
|
||||||
return(-1); /* impossible */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test21a()
|
void test21a()
|
||||||
|
@ -360,12 +353,6 @@ void test21e()
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (mkdir("D1", 0777) != -1) e(8);
|
if (mkdir("D1", 0777) != -1) e(8);
|
||||||
if (errno != EEXIST) e(9);
|
if (errno != EEXIST) e(9);
|
||||||
#if NAME_MAX == 14
|
|
||||||
if (mkdir("D1/ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0777) != 0) e(10);
|
|
||||||
if (access("D1/ABCDEFGHIJKLMN", 7 ) != 0) e(11);
|
|
||||||
if (rmdir("D1/ABCDEFGHIJKLMNOPQ") != 0) e(12);
|
|
||||||
if (access("D1/ABCDEFGHIJKLMN", 7 ) != -1) e(13);
|
|
||||||
#endif
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (mkdir("D1/D2/x", 0777) != -1) e(14);
|
if (mkdir("D1/D2/x", 0777) != -1) e(14);
|
||||||
if (errno != ENOENT) e(15);
|
if (errno != ENOENT) e(15);
|
||||||
|
@ -651,32 +638,3 @@ char *name;
|
||||||
return(statbuf.st_nlink);
|
return(statbuf.st_nlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* save errno in case printf clobbers it */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d ", subtest, n, errno);
|
|
||||||
errno = err_num; /* restore errno, just in case */
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||||
|
|
||||||
int errct = 0; /* Total error counter. */
|
#include "common.c"
|
||||||
int subtest = 1;
|
|
||||||
|
|
||||||
_PROTOTYPE(void test22a, (void));
|
_PROTOTYPE(void test22a, (void));
|
||||||
_PROTOTYPE(int mode, (char *filename));
|
_PROTOTYPE(int mode, (char *filename));
|
||||||
|
@ -31,11 +30,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 22 ");
|
start(22);
|
||||||
fflush(stdout);
|
|
||||||
system("chmod 777 DIR_22/* DIR_22/*/* > /dev/null 2>&1");
|
|
||||||
System("rm -rf DIR_22; mkdir DIR_22");
|
|
||||||
Chdir("DIR_22");
|
|
||||||
|
|
||||||
for (i = 0; i < ITERATIONS; i++) {
|
for (i = 0; i < ITERATIONS; i++) {
|
||||||
if (m & 0001) test22a();
|
if (m & 0001) test22a();
|
||||||
|
@ -165,34 +160,3 @@ char *arg;
|
||||||
return 0777 ^ mode(arg);
|
return 0777 ^ mode(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* Save in case printf clobbers it. */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d: ", subtest, n, errno);
|
|
||||||
errno = err_num;
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
Chdir("..");
|
|
||||||
system("chmod 777 ../DIR_22/* ../DIR_22/*/* > /dev/null 2>&1");
|
|
||||||
System("rm -rf DIR_22");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,17 +25,15 @@ int superuser; /* True if we are root. */
|
||||||
char cwd[PATH_MAX]; /* Space for path names. */
|
char cwd[PATH_MAX]; /* Space for path names. */
|
||||||
char cwd2[PATH_MAX];
|
char cwd2[PATH_MAX];
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
_PROTOTYPE(void test23a, (void));
|
_PROTOTYPE(void test23a, (void));
|
||||||
_PROTOTYPE(void test23b, (void));
|
_PROTOTYPE(void test23b, (void));
|
||||||
_PROTOTYPE(void test23c, (void));
|
_PROTOTYPE(void test23c, (void));
|
||||||
_PROTOTYPE(void makelongnames, (void)); /* Fill MaxName etc. */
|
_PROTOTYPE(void makelongnames, (void)); /* Fill MaxName etc. */
|
||||||
_PROTOTYPE(char *last_index, (char *string, int ch));
|
|
||||||
_PROTOTYPE(char *my_getcwd, (char *buf, int size));
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -135,7 +133,7 @@ void test23b()
|
||||||
|
|
||||||
System("rm -rf ../DIR_23/*");
|
System("rm -rf ../DIR_23/*");
|
||||||
|
|
||||||
/* Fiddle with the size (2nt) parameter of `getcwd ()'. */
|
/* Fiddle with the size (2nd) parameter of `getcwd ()'. */
|
||||||
if (getcwd(cwd, PATH_MAX) != cwd) e(1); /* get cwd */
|
if (getcwd(cwd, PATH_MAX) != cwd) e(1); /* get cwd */
|
||||||
if (getcwd(buf, strlen(cwd)) != (char *) 0) e(2); /* size 1 to small */
|
if (getcwd(buf, strlen(cwd)) != (char *) 0) e(2); /* size 1 to small */
|
||||||
if (errno != ERANGE) e(3);
|
if (errno != ERANGE) e(3);
|
||||||
|
@ -279,9 +277,15 @@ void test23c()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -291,79 +295,9 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following code, is take from pwd written by Adri Koppes */
|
|
||||||
|
|
||||||
/* My_getcwd() helper. */
|
|
||||||
char *last_index(string, ch)
|
|
||||||
char *string;
|
|
||||||
char ch;
|
|
||||||
{
|
|
||||||
register char *retval = '\0';
|
|
||||||
|
|
||||||
while (*string != '\0') {
|
|
||||||
if (*string == ch) retval = string;
|
|
||||||
string++;
|
|
||||||
}
|
|
||||||
return(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *my_getcwd(buf, size)
|
|
||||||
char *buf;
|
|
||||||
int size;
|
|
||||||
{ /* should be like getcwd() */
|
|
||||||
int sd;
|
|
||||||
register int fd;
|
|
||||||
register char *n;
|
|
||||||
char name[128];
|
|
||||||
struct stat s, st, sk;
|
|
||||||
struct direct d;
|
|
||||||
|
|
||||||
if (size <= 0) return(char *) 0;
|
|
||||||
|
|
||||||
*buf = '\0';
|
|
||||||
*name = '\0';
|
|
||||||
stat(".", &s);
|
|
||||||
do {
|
|
||||||
if ((fd = open("..", O_RDONLY)) < 0) return(char *) 0;
|
|
||||||
st.st_dev = s.st_dev;
|
|
||||||
st.st_ino = s.st_ino;
|
|
||||||
stat("..", &s);
|
|
||||||
Chdir("..");
|
|
||||||
sd = sizeof(struct direct);
|
|
||||||
if (s.st_dev == st.st_dev) {
|
|
||||||
do {
|
|
||||||
if (read(fd, (char *) &d, sd) < sd) return(char *) 0;
|
|
||||||
} while (d.d_ino != st.st_ino);
|
|
||||||
} else {
|
|
||||||
do {
|
|
||||||
if (read(fd, (char *) &d, sd) < sd) return(char *) 0;
|
|
||||||
stat(d.d_name, &sk);
|
|
||||||
} while ((sk.st_dev != st.st_dev) ||
|
|
||||||
(sk.st_ino != st.st_ino));
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
if (strcmp(".", d.d_name) != 0) {
|
|
||||||
strcat(name, "/");
|
|
||||||
strcat(name, d.d_name);
|
|
||||||
}
|
|
||||||
} while ((s.st_ino != st.st_ino) || (s.st_dev != st.st_dev));
|
|
||||||
if (*name == '\0')
|
|
||||||
strncat(buf, "/", size);
|
|
||||||
else
|
|
||||||
while ((n = last_index(name, '/')) != NULL) {
|
|
||||||
n[NAME_MAX] = '\0';
|
|
||||||
strncat(buf, n, size - strlen(buf));
|
|
||||||
*n = '\0';
|
|
||||||
}
|
|
||||||
strncat(buf, name, size - strlen(buf));
|
|
||||||
buf[size - 1] = '\0';
|
|
||||||
Chdir(buf); /* get back there */
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -32,21 +32,17 @@ _PROTOTYPE(void makelongnames, (void));
|
||||||
int subtest = 1;
|
int subtest = 1;
|
||||||
int superuser;
|
int superuser;
|
||||||
|
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, m = 0xFFFF;
|
int i, m = 0xFFFF;
|
||||||
|
|
||||||
sync();
|
start(24);
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 24 ");
|
|
||||||
fflush(stdout);
|
|
||||||
System("rm -rf DIR_24; mkdir DIR_24");
|
|
||||||
Chdir("DIR_24");
|
|
||||||
makelongnames();
|
makelongnames();
|
||||||
superuser = (geteuid() == 0);
|
superuser = (geteuid() == 0);
|
||||||
|
|
||||||
|
@ -171,13 +167,18 @@ void test24b()
|
||||||
int i, j; /* i = highest open dir count */
|
int i, j; /* i = highest open dir count */
|
||||||
DIR *dirp[OVERFLOW_DIR_NR], *dp;
|
DIR *dirp[OVERFLOW_DIR_NR], *dp;
|
||||||
struct dirent *dep, *dep1, *dep2;
|
struct dirent *dep, *dep1, *dep2;
|
||||||
char name[NAME_MAX + 2]; /* buffer for file name, and count */
|
char *name; /* buffer for file name, and count */
|
||||||
int dot = 0, dotdot = 0;
|
int dot = 0, dotdot = 0;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
subtest = 2;
|
subtest = 2;
|
||||||
|
|
||||||
System("rm -rf ../DIR_24/*");
|
System("rm -rf ../DIR_24/*");
|
||||||
|
|
||||||
|
max_name_length = name_max(".");
|
||||||
|
name = malloc(max_name_length + 2);
|
||||||
|
memset(name, '\0', max_name_length + 2);
|
||||||
|
|
||||||
for (i = 0; i < OVERFLOW_DIR_NR; i++) {
|
for (i = 0; i < OVERFLOW_DIR_NR; i++) {
|
||||||
dirp[i] = opendir("/");
|
dirp[i] = opendir("/");
|
||||||
if (dirp[i] == ((DIR *) NULL)) {
|
if (dirp[i] == ((DIR *) NULL)) {
|
||||||
|
@ -195,7 +196,7 @@ void test24b()
|
||||||
System("rm -rf foo; mkdir foo");
|
System("rm -rf foo; mkdir foo");
|
||||||
Chdir("foo");
|
Chdir("foo");
|
||||||
name[0] = 0;
|
name[0] = 0;
|
||||||
for (i = 0; i <= NAME_MAX; i++) {
|
for (i = 0; i <= max_name_length; i++) {
|
||||||
if (strcat(name, "X") != name) e(5);
|
if (strcat(name, "X") != name) e(5);
|
||||||
close(creat(name, 0666)); /* fails once on */
|
close(creat(name, 0666)); /* fails once on */
|
||||||
} /* XX..XX, 1 too long */
|
} /* XX..XX, 1 too long */
|
||||||
|
@ -211,13 +212,13 @@ void test24b()
|
||||||
name[strlen(dep->d_name)] += 1; /* 'X' + 1 == 'Y' */
|
name[strlen(dep->d_name)] += 1; /* 'X' + 1 == 'Y' */
|
||||||
}
|
}
|
||||||
if (closedir(dp) != 0) e(7);
|
if (closedir(dp) != 0) e(7);
|
||||||
for (i = 1; i <= NAME_MAX; i++) { /* Check if every length */
|
for (i = 1; i <= max_name_length; i++) { /* Check if every length */
|
||||||
if (name[i] != 'Y') e(8); /* has been seen once. */
|
if (name[i] != 'Y') e(8); /* has been seen once. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check upper and lower bound. */
|
/* Check upper and lower bound. */
|
||||||
if (name[0] != 'X') e(9);
|
if (name[0] != 'X') e(9);
|
||||||
if (name[NAME_MAX + 1] != '\0') e(10);
|
if (name[max_name_length + 1] != '\0') e(10);
|
||||||
|
|
||||||
/* Now check if two simultaniouse open dirs do the same */
|
/* Now check if two simultaniouse open dirs do the same */
|
||||||
if ((dirp[1] = opendir("foo")) == ((DIR *) NULL)) e(11);
|
if ((dirp[1] = opendir("foo")) == ((DIR *) NULL)) e(11);
|
||||||
|
@ -343,9 +344,15 @@ DIR *dirp; /* (`f1', `f3', `f5', `.', `..') */
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -355,9 +362,8 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
|
|
||||||
int subtest = 1;
|
int subtest = 1;
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
_PROTOTYPE(void test25a, (void));
|
_PROTOTYPE(void test25a, (void));
|
||||||
|
@ -40,8 +40,6 @@ _PROTOTYPE(void test25c, (void));
|
||||||
_PROTOTYPE(void test25d, (void));
|
_PROTOTYPE(void test25d, (void));
|
||||||
_PROTOTYPE(void test25e, (void));
|
_PROTOTYPE(void test25e, (void));
|
||||||
_PROTOTYPE(void makelongnames, (void));
|
_PROTOTYPE(void makelongnames, (void));
|
||||||
_PROTOTYPE(void e, (int number));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -50,8 +48,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
|
||||||
start(25);
|
start(25);
|
||||||
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
makelongnames();
|
makelongnames();
|
||||||
superuser = (geteuid() == 0);
|
superuser = (geteuid() == 0);
|
||||||
|
|
||||||
|
@ -66,7 +64,6 @@ int main(int argc, char *argv[])
|
||||||
if (m & 020) test25e();
|
if (m & 020) test25e();
|
||||||
}
|
}
|
||||||
quit();
|
quit();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test25a()
|
void test25a()
|
||||||
|
@ -688,9 +685,15 @@ void test25e()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -700,8 +703,8 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,18 +20,11 @@
|
||||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||||
#define Mkfifo(f) if (mkfifo(f,0777)!=0) printf("Can't make fifo %s\n", f)
|
#define Mkfifo(f) if (mkfifo(f,0777)!=0) printf("Can't make fifo %s\n", f)
|
||||||
|
|
||||||
int errct = 0;
|
#include "common.c"
|
||||||
int subtest = 1;
|
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
|
||||||
|
|
||||||
_PROTOTYPE(void test26a, (void));
|
_PROTOTYPE(void test26a, (void));
|
||||||
_PROTOTYPE(void test26b, (void));
|
_PROTOTYPE(void test26b, (void));
|
||||||
_PROTOTYPE(void test26c, (void));
|
_PROTOTYPE(void test26c, (void));
|
||||||
_PROTOTYPE(void e, (int number));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -39,10 +32,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 26 ");
|
|
||||||
fflush(stdout);
|
start(26);
|
||||||
System("rm -rf DIR_26; mkdir DIR_26");
|
|
||||||
Chdir("DIR_26");
|
|
||||||
|
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
if (m & 0001) test26a();
|
if (m & 0001) test26a();
|
||||||
|
@ -241,33 +232,3 @@ void test26c()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* Save in case printf clobbers it. */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d: ", subtest, n, errno);
|
|
||||||
errno = err_num;
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
Chdir("..");
|
|
||||||
System("rm -rf DIR_26");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,31 +19,25 @@
|
||||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||||
|
|
||||||
int errct = 0;
|
#include "common.c"
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX];
|
char MaxPath[PATH_MAX];
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1];
|
char ToLongPath[PATH_MAX + 1];
|
||||||
|
|
||||||
_PROTOTYPE(void test27a, (void));
|
_PROTOTYPE(void test27a, (void));
|
||||||
_PROTOTYPE(void test27b, (void));
|
_PROTOTYPE(void test27b, (void));
|
||||||
_PROTOTYPE(void test27c, (void));
|
_PROTOTYPE(void test27c, (void));
|
||||||
_PROTOTYPE(void makelongnames, (void));
|
_PROTOTYPE(void makelongnames, (void));
|
||||||
_PROTOTYPE(void e, (int __n));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, m = 0xFFFF;
|
int i, m = 0xFFFF;
|
||||||
|
|
||||||
sync();
|
start(27);
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 27 ");
|
|
||||||
fflush(stdout);
|
|
||||||
System("rm -rf DIR_27; mkdir DIR_27");
|
|
||||||
Chdir("DIR_27");
|
|
||||||
superuser = (getuid() == 0);
|
superuser = (getuid() == 0);
|
||||||
makelongnames();
|
makelongnames();
|
||||||
|
|
||||||
|
@ -295,9 +289,15 @@ void test27c()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -307,39 +307,9 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* Save in case printf clobbers it. */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d: ", subtest, n, errno);
|
|
||||||
errno = err_num;
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
Chdir("..");
|
|
||||||
System("rm -rf DIR_27");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
int subtest = 1;
|
int subtest = 1;
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX];
|
char MaxPath[PATH_MAX];
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1];
|
char ToLongPath[PATH_MAX + 1];
|
||||||
|
|
||||||
_PROTOTYPE(void test28a, (void));
|
_PROTOTYPE(void test28a, (void));
|
||||||
|
@ -59,7 +59,6 @@ int main(int argc, char *argv[])
|
||||||
if (m & 0004) test28c();
|
if (m & 0004) test28c();
|
||||||
}
|
}
|
||||||
quit();
|
quit();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test28a()
|
void test28a()
|
||||||
|
@ -393,9 +392,15 @@ void test28c()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -405,9 +410,8 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,19 +34,13 @@
|
||||||
#define IS_CLOEXEC(fd) ((fcntl(fd, F_GETFD) & FD_CLOEXEC) == FD_CLOEXEC)
|
#define IS_CLOEXEC(fd) ((fcntl(fd, F_GETFD) & FD_CLOEXEC) == FD_CLOEXEC)
|
||||||
#define SET_CLOEXEC(fd) fcntl(fd, F_SETFD, FD_CLOEXEC)
|
#define SET_CLOEXEC(fd) fcntl(fd, F_SETFD, FD_CLOEXEC)
|
||||||
|
|
||||||
int errct = 0;
|
#include "common.c"
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
|
||||||
|
|
||||||
_PROTOTYPE(void test29a, (void));
|
_PROTOTYPE(void test29a, (void));
|
||||||
_PROTOTYPE(void test29b, (void));
|
_PROTOTYPE(void test29b, (void));
|
||||||
_PROTOTYPE(void test29c, (void));
|
_PROTOTYPE(void test29c, (void));
|
||||||
_PROTOTYPE(void e, (int number));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -54,10 +48,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 29 ");
|
|
||||||
fflush(stdout);
|
start(29);
|
||||||
System("rm -rf DIR_29; mkdir DIR_29");
|
|
||||||
Chdir("DIR_29");
|
|
||||||
superuser = (geteuid() == 0);
|
superuser = (geteuid() == 0);
|
||||||
|
|
||||||
for (i = 0; i < ITERATIONS; i++) {
|
for (i = 0; i < ITERATIONS; i++) {
|
||||||
|
@ -210,34 +202,3 @@ void test29c()
|
||||||
|
|
||||||
System("rm -rf ../DIR_29/*");
|
System("rm -rf ../DIR_29/*");
|
||||||
}
|
}
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* Save in case printf clobbers it. */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d: ", subtest, n, errno);
|
|
||||||
errno = err_num;
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
Chdir("..");
|
|
||||||
System("rm -rf DIR_29");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -28,19 +28,16 @@
|
||||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||||
|
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
_PROTOTYPE(void test30a, (void));
|
_PROTOTYPE(void test30a, (void));
|
||||||
_PROTOTYPE(void test30b, (void));
|
_PROTOTYPE(void test30b, (void));
|
||||||
_PROTOTYPE(void test30c, (void));
|
_PROTOTYPE(void test30c, (void));
|
||||||
_PROTOTYPE(void makelongnames, (void));
|
_PROTOTYPE(void makelongnames, (void));
|
||||||
_PROTOTYPE(void e, (int number));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -286,9 +283,15 @@ void test30c()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -298,9 +301,8 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,10 @@
|
||||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||||
|
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
_PROTOTYPE(void test31a, (void));
|
_PROTOTYPE(void test31a, (void));
|
||||||
|
@ -214,9 +213,15 @@ void test31c()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -226,9 +231,8 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,31 +20,26 @@
|
||||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||||
#define Creat(f) if (close(creat(f,0777))!=0) printf("Can't creat %s\n",f)
|
#define Creat(f) if (close(creat(f,0777))!=0) printf("Can't creat %s\n",f)
|
||||||
|
|
||||||
int errct = 0;
|
#include "common.c"
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
_PROTOTYPE(void test32a, (void));
|
_PROTOTYPE(void test32a, (void));
|
||||||
_PROTOTYPE(void test32b, (void));
|
_PROTOTYPE(void test32b, (void));
|
||||||
_PROTOTYPE(void test32c, (void));
|
_PROTOTYPE(void test32c, (void));
|
||||||
_PROTOTYPE(void makelongnames, (void));
|
_PROTOTYPE(void makelongnames, (void));
|
||||||
_PROTOTYPE(void e, (int number));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, m = 0xFFFF;
|
int i, m = 0xFFFF;
|
||||||
|
|
||||||
sync();
|
start(32);
|
||||||
|
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 32 ");
|
|
||||||
fflush(stdout);
|
|
||||||
System("rm -rf DIR_32; mkdir DIR_32");
|
|
||||||
Chdir("DIR_32");
|
|
||||||
makelongnames();
|
makelongnames();
|
||||||
superuser = (geteuid() == 0);
|
superuser = (geteuid() == 0);
|
||||||
|
|
||||||
|
@ -54,7 +49,6 @@ int main(int argc, char *argv[])
|
||||||
if (m & 0004) test32c();
|
if (m & 0004) test32c();
|
||||||
}
|
}
|
||||||
quit();
|
quit();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BUF_SIZE 1024
|
#define BUF_SIZE 1024
|
||||||
|
@ -315,9 +309,15 @@ void test32c()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -327,39 +327,8 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* Save in case printf clobbers it. */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d: ", subtest, n, errno);
|
|
||||||
errno = err_num;
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
Chdir("..");
|
|
||||||
System("rm -rf DIR_32");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -23,11 +23,10 @@
|
||||||
#define Chmod(a,b) if (chmod(a,b) != 0) printf("Can't chmod %s\n", a)
|
#define Chmod(a,b) if (chmod(a,b) != 0) printf("Can't chmod %s\n", a)
|
||||||
#define Mkfifo(f) if (mkfifo(f,0777)!=0) printf("Can't make fifo %s\n", f)
|
#define Mkfifo(f) if (mkfifo(f,0777)!=0) printf("Can't make fifo %s\n", f)
|
||||||
|
|
||||||
int subtest = 1;
|
|
||||||
int superuser; /* nonzero if uid == euid (euid == 0 always) */
|
int superuser; /* nonzero if uid == euid (euid == 0 always) */
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *ToLongName; /* Name of maximum +1 length */
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
_PROTOTYPE(void test33a, (void));
|
_PROTOTYPE(void test33a, (void));
|
||||||
|
@ -600,9 +599,15 @@ void test_access()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
ToLongName = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
|
@ -612,9 +617,8 @@ void makelongnames()
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(ToLongPath, MaxPath);
|
strcpy(ToLongPath, MaxPath);
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
ToLongName[max_name_length] = 'a';
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
ToLongName[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
ToLongPath[PATH_MAX - 1] = '/';
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,11 @@
|
||||||
/* This program uses /etc/passwd and assumes things about it's contents. */
|
/* This program uses /etc/passwd and assumes things about it's contents. */
|
||||||
#define PASSWD_FILE "/etc/passwd"
|
#define PASSWD_FILE "/etc/passwd"
|
||||||
|
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
int I_can_chown;
|
int I_can_chown;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char NameTooLong[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *NameTooLong; /* Name of maximum +1 length */
|
||||||
char PathTooLong[PATH_MAX + 1]; /* Same for path, both too long */
|
char PathTooLong[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
_PROTOTYPE(void test34a, (void));
|
_PROTOTYPE(void test34a, (void));
|
||||||
|
@ -541,22 +540,28 @@ void test34c()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
NameTooLong = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
}
|
}
|
||||||
MaxPath[PATH_MAX - 1] = '\0';
|
MaxPath[PATH_MAX - 1] = '\0';
|
||||||
|
|
||||||
strcpy(NameTooLong, MaxName); /* copy them Max to TooLong */
|
strcpy(NameTooLong, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(PathTooLong, MaxPath);
|
strcpy(PathTooLong, MaxPath);
|
||||||
|
|
||||||
NameTooLong[NAME_MAX] = 'a';
|
NameTooLong[max_name_length] = 'a';
|
||||||
NameTooLong[NAME_MAX + 1] = '\0'; /* extend NameTooLong by one too many*/
|
NameTooLong[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
PathTooLong[PATH_MAX - 1] = '/';
|
PathTooLong[PATH_MAX - 1] = '/';
|
||||||
PathTooLong[PATH_MAX] = '\0'; /* inc PathTooLong by one */
|
PathTooLong[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Getids returns a valid uid and gid. Is used PASSWD FILE.
|
/* Getids returns a valid uid and gid. Is used PASSWD FILE.
|
||||||
|
|
|
@ -32,12 +32,11 @@
|
||||||
|
|
||||||
#define PASSWD_FILE "/etc/passwd"
|
#define PASSWD_FILE "/etc/passwd"
|
||||||
|
|
||||||
int subtest = 1;
|
|
||||||
int I_can_chown;
|
int I_can_chown;
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
char *MaxName; /* Name of maximum length */
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
char MaxPath[PATH_MAX]; /* Same for path */
|
||||||
char NameTooLong[NAME_MAX + 2]; /* Name of maximum +1 length */
|
char *NameTooLong; /* Name of maximum +1 length */
|
||||||
char PathTooLong[PATH_MAX + 1]; /* Same for path, both too long */
|
char PathTooLong[PATH_MAX + 1]; /* Same for path, both too long */
|
||||||
|
|
||||||
_PROTOTYPE(void test35a, (void));
|
_PROTOTYPE(void test35a, (void));
|
||||||
|
@ -283,22 +282,28 @@ void test35c()
|
||||||
void makelongnames()
|
void makelongnames()
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
int max_name_length;
|
||||||
|
|
||||||
|
max_name_length = name_max("."); /* Aka NAME_MAX, but not every FS supports
|
||||||
|
* the same length, hence runtime check */
|
||||||
|
MaxName = malloc(max_name_length + 1);
|
||||||
|
NameTooLong = malloc(max_name_length + 1 + 1); /* Name of maximum +1 length */
|
||||||
|
memset(MaxName, 'a', max_name_length);
|
||||||
|
MaxName[max_name_length] = '\0';
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
||||||
MaxPath[i++] = '.';
|
MaxPath[i++] = '.';
|
||||||
MaxPath[i] = '/';
|
MaxPath[i] = '/';
|
||||||
}
|
}
|
||||||
MaxPath[PATH_MAX - 1] = '\0';
|
MaxPath[PATH_MAX - 1] = '\0';
|
||||||
|
|
||||||
strcpy(NameTooLong, MaxName); /* copy them Max to TooLong */
|
strcpy(NameTooLong, MaxName); /* copy them Max to ToLong */
|
||||||
strcpy(PathTooLong, MaxPath);
|
strcpy(PathTooLong, MaxPath);
|
||||||
|
|
||||||
NameTooLong[NAME_MAX] = 'a';
|
NameTooLong[max_name_length] = 'a';
|
||||||
NameTooLong[NAME_MAX + 1] = '\0'; /* extend NameTooLong by one too many*/
|
NameTooLong[max_name_length+1] = '\0';/* extend ToLongName by one too many */
|
||||||
PathTooLong[PATH_MAX - 1] = '/';
|
PathTooLong[PATH_MAX - 1] = '/';
|
||||||
PathTooLong[PATH_MAX] = '\0'; /* inc PathTooLong by one */
|
PathTooLong[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Getids returns a valid uid and gid. Is used PASSWD FILE.
|
/* Getids returns a valid uid and gid. Is used PASSWD FILE.
|
||||||
|
|
|
@ -19,21 +19,14 @@
|
||||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||||
|
|
||||||
int errct = 0;
|
#include "common.c"
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
char MaxName[NAME_MAX + 1]; /* Name of maximum length */
|
|
||||||
char MaxPath[PATH_MAX]; /* Same for path */
|
|
||||||
char ToLongName[NAME_MAX + 2]; /* Name of maximum +1 length */
|
|
||||||
char ToLongPath[PATH_MAX + 1]; /* Same for path, both too long */
|
|
||||||
|
|
||||||
_PROTOTYPE(void test36a, (void));
|
_PROTOTYPE(void test36a, (void));
|
||||||
_PROTOTYPE(void test36b, (void));
|
_PROTOTYPE(void test36b, (void));
|
||||||
_PROTOTYPE(void test36c, (void));
|
_PROTOTYPE(void test36c, (void));
|
||||||
_PROTOTYPE(void test36d, (void));
|
_PROTOTYPE(void test36d, (void));
|
||||||
_PROTOTYPE(void makelongnames, (void));
|
|
||||||
_PROTOTYPE(void e, (int number));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
_PROTOTYPE(int not_provided_option, (int _option));
|
_PROTOTYPE(int not_provided_option, (int _option));
|
||||||
_PROTOTYPE(int provided_option, (int _option, int _minimum_value));
|
_PROTOTYPE(int provided_option, (int _option, int _minimum_value));
|
||||||
_PROTOTYPE(int variating_option, (int _option, int _minimum_value));
|
_PROTOTYPE(int variating_option, (int _option, int _minimum_value));
|
||||||
|
@ -65,12 +58,8 @@ int main(int argc, char *argv[])
|
||||||
int i, m = 0xFFFF;
|
int i, m = 0xFFFF;
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
|
start(36);
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 36 ");
|
|
||||||
fflush(stdout);
|
|
||||||
System("rm -rf DIR_36; mkdir DIR_36");
|
|
||||||
Chdir("DIR_36");
|
|
||||||
makelongnames();
|
|
||||||
superuser = (geteuid() == 0);
|
superuser = (geteuid() == 0);
|
||||||
|
|
||||||
for (i = 0; i < ITERATIONS; i++) {
|
for (i = 0; i < ITERATIONS; i++) {
|
||||||
|
@ -141,58 +130,6 @@ void test36d()
|
||||||
System("rm -rf ../DIR_36/*");
|
System("rm -rf ../DIR_36/*");
|
||||||
}
|
}
|
||||||
|
|
||||||
void makelongnames()
|
|
||||||
{
|
|
||||||
register int i;
|
|
||||||
|
|
||||||
memset(MaxName, 'a', NAME_MAX);
|
|
||||||
MaxName[NAME_MAX] = '\0';
|
|
||||||
for (i = 0; i < PATH_MAX - 1; i++) { /* idem path */
|
|
||||||
MaxPath[i++] = '.';
|
|
||||||
MaxPath[i] = '/';
|
|
||||||
}
|
|
||||||
MaxPath[PATH_MAX - 1] = '\0';
|
|
||||||
|
|
||||||
strcpy(ToLongName, MaxName); /* copy them Max to ToLong */
|
|
||||||
strcpy(ToLongPath, MaxPath);
|
|
||||||
|
|
||||||
ToLongName[NAME_MAX] = 'a';
|
|
||||||
ToLongName[NAME_MAX + 1] = '\0'; /* extend ToLongName by one too many */
|
|
||||||
ToLongPath[PATH_MAX - 1] = '/';
|
|
||||||
ToLongPath[PATH_MAX] = '\0'; /* inc ToLongPath by one */
|
|
||||||
}
|
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* Save in case printf clobbers it. */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d: ", subtest, n, errno);
|
|
||||||
errno = err_num;
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
Chdir("..");
|
|
||||||
System("rm -rf DIR_36");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int not_provided_option(option)
|
int not_provided_option(option)
|
||||||
int option;
|
int option;
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
#define SIGS 14
|
#define SIGS 14
|
||||||
#define MAX_ERROR 4
|
#define MAX_ERROR 4
|
||||||
|
|
||||||
int iteration, cumsig, subtest, errct = 0, sig1, sig2;
|
#include "common.c"
|
||||||
|
|
||||||
|
int iteration, cumsig, sig1, sig2;
|
||||||
|
|
||||||
int sigarray[SIGS] = {SIGHUP, SIGILL, SIGTRAP, SIGABRT, SIGIOT,
|
int sigarray[SIGS] = {SIGHUP, SIGILL, SIGTRAP, SIGABRT, SIGIOT,
|
||||||
SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE, SIGALRM,
|
SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE, SIGALRM,
|
||||||
|
@ -64,9 +66,7 @@ _PROTOTYPE(void test37n, (void));
|
||||||
_PROTOTYPE(void catch15, (int signo));
|
_PROTOTYPE(void catch15, (int signo));
|
||||||
_PROTOTYPE(void test37o, (void));
|
_PROTOTYPE(void test37o, (void));
|
||||||
_PROTOTYPE(void clearsigstate, (void));
|
_PROTOTYPE(void clearsigstate, (void));
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
_PROTOTYPE(void wait_for, (int pid));
|
_PROTOTYPE(void wait_for, (int pid));
|
||||||
_PROTOTYPE(void e, (int n));
|
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
|
@ -76,14 +76,10 @@ char *argv[];
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
|
start(37);
|
||||||
|
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
|
|
||||||
printf("Test 37 ");
|
|
||||||
fflush(stdout); /* have to flush for child's benefit */
|
|
||||||
|
|
||||||
system("rm -rf DIR_37; mkdir DIR_37");
|
|
||||||
chdir("DIR_37");
|
|
||||||
|
|
||||||
for (i = 0; i < ITERATIONS; i++) {
|
for (i = 0; i < ITERATIONS; i++) {
|
||||||
iteration = i;
|
iteration = i;
|
||||||
if (m & 0000001) test37a();
|
if (m & 0000001) test37a();
|
||||||
|
@ -106,7 +102,6 @@ char *argv[];
|
||||||
}
|
}
|
||||||
|
|
||||||
quit();
|
quit();
|
||||||
return(-1); /* impossible */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test37a()
|
void test37a()
|
||||||
|
@ -1001,21 +996,6 @@ void clearsigstate()
|
||||||
sigprocmask(SIG_UNBLOCK, &sigset_var, (sigset_t *)NULL);
|
sigprocmask(SIG_UNBLOCK, &sigset_var, (sigset_t *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wait_for(pid)
|
void wait_for(pid)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
{
|
{
|
||||||
|
@ -1041,17 +1021,3 @@ pid_t pid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
char msgbuf[80];
|
|
||||||
|
|
||||||
sprintf(msgbuf, "Subtest %d, error %d errno=%d ", subtest, n, errno);
|
|
||||||
perror(msgbuf);
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
fprintf(stderr, "Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||||
|
|
||||||
int errct = 0;
|
#include "common.c"
|
||||||
int subtest = 1;
|
|
||||||
int superuser;
|
int superuser;
|
||||||
int signumber = 0;
|
int signumber = 0;
|
||||||
|
|
||||||
|
@ -35,19 +35,15 @@ _PROTOTYPE(void test38a, (void));
|
||||||
_PROTOTYPE(void test38b, (void));
|
_PROTOTYPE(void test38b, (void));
|
||||||
_PROTOTYPE(void test38c, (void));
|
_PROTOTYPE(void test38c, (void));
|
||||||
_PROTOTYPE(void setsignumber, (int _signumber));
|
_PROTOTYPE(void setsignumber, (int _signumber));
|
||||||
_PROTOTYPE(void e, (int number));
|
|
||||||
_PROTOTYPE(void quit, (void));
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, m = 0xFFFF;
|
int i, m = 0xFFFF;
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
|
start(38);
|
||||||
|
|
||||||
if (argc == 2) m = atoi(argv[1]);
|
if (argc == 2) m = atoi(argv[1]);
|
||||||
printf("Test 38 ");
|
|
||||||
fflush(stdout);
|
|
||||||
System("rm -rf DIR_38; mkdir DIR_38");
|
|
||||||
Chdir("DIR_38");
|
|
||||||
superuser = (geteuid() == 0);
|
superuser = (geteuid() == 0);
|
||||||
umask(0000);
|
umask(0000);
|
||||||
|
|
||||||
|
@ -57,7 +53,6 @@ int main(int argc, char *argv[])
|
||||||
if (m & 0004) test38c();
|
if (m & 0004) test38c();
|
||||||
}
|
}
|
||||||
quit();
|
quit();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test38a()
|
void test38a()
|
||||||
|
@ -736,33 +731,3 @@ int signum;
|
||||||
signumber = signum;
|
signumber = signum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void e(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
int err_num = errno; /* Save in case printf clobbers it. */
|
|
||||||
|
|
||||||
printf("Subtest %d, error %d errno=%d: ", subtest, n, errno);
|
|
||||||
errno = err_num;
|
|
||||||
perror("");
|
|
||||||
if (errct++ > MAX_ERROR) {
|
|
||||||
printf("Too many errors; test aborted\n");
|
|
||||||
chdir("..");
|
|
||||||
system("rm -rf DIR*");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
Chdir("..");
|
|
||||||
System("rm -rf DIR_38");
|
|
||||||
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,38 +2,33 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <minix/endpoint.h>
|
#include <minix/endpoint.h>
|
||||||
#include <minix/sys_config.h>
|
#include <minix/sys_config.h>
|
||||||
|
#define MAX_ERROR 1
|
||||||
|
#include "common.c"
|
||||||
|
|
||||||
|
_PROTOTYPE( void test39a, (void) );
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int g, p;
|
start(39);
|
||||||
|
quit();
|
||||||
printf("Test 39 ");
|
|
||||||
|
|
||||||
for(g = 0; g <= _ENDPOINT_MAX_GENERATION; g++) {
|
|
||||||
for(p = -MAX_NR_TASKS; p < _NR_PROCS; p++) {
|
|
||||||
endpoint_t e;
|
|
||||||
int mg, mp;
|
|
||||||
e = _ENDPOINT(g, p);
|
|
||||||
mg = _ENDPOINT_G(e);
|
|
||||||
mp = _ENDPOINT_P(e);
|
|
||||||
if(mg != g || mp != p) {
|
|
||||||
printf("%d != %d || %d != %d\n", mg, g, mp, p);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(g == 0 && e != p) {
|
|
||||||
printf("%d != %d and g=0\n", e, p);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(e == ANY || e == SELF || e == NONE) {
|
|
||||||
printf("endpoint (%d,%d) is %d; ANY, SELF or NONE\n",
|
|
||||||
g, p, e);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("ok\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test39a()
|
||||||
|
{
|
||||||
|
int g, p;
|
||||||
|
|
||||||
|
subtest = 1;
|
||||||
|
|
||||||
|
for (g = 0; g <= _ENDPOINT_MAX_GENERATION; g++) {
|
||||||
|
for (p = -MAX_NR_TASKS; p < _NR_PROCS; p++) {
|
||||||
|
endpoint_t ept;
|
||||||
|
int mg, mp;
|
||||||
|
ept = _ENDPOINT(g, p);
|
||||||
|
mg = _ENDPOINT_G(ept);
|
||||||
|
mp = _ENDPOINT_P(ept);
|
||||||
|
if (mg != g || mp != p) e(1);
|
||||||
|
if (g == 0 && ept != p) e(2);
|
||||||
|
if (ept == ANY || ept == SELF || ept == NONE) e(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,23 +11,12 @@
|
||||||
#define MAX_ERROR 4
|
#define MAX_ERROR 4
|
||||||
#define TIMED 0
|
#define TIMED 0
|
||||||
|
|
||||||
static volatile int errct;
|
#include "common.c"
|
||||||
|
|
||||||
static volatile int expect_SIGFPE;
|
static volatile int expect_SIGFPE;
|
||||||
static u64_t i, j, k;
|
static u64_t i, j, k;
|
||||||
static jmp_buf jmpbuf_SIGFPE, jmpbuf_main;
|
static jmp_buf jmpbuf_SIGFPE, jmpbuf_main;
|
||||||
|
|
||||||
static void quit(void)
|
|
||||||
{
|
|
||||||
if (errct == 0) {
|
|
||||||
printf("ok\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
printf("%d errors\n", errct);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
assert(0); /* not reachable */
|
|
||||||
}
|
|
||||||
|
|
||||||
static void err(int line)
|
static void err(int line)
|
||||||
{
|
{
|
||||||
/* print error information */
|
/* print error information */
|
||||||
|
@ -272,7 +261,7 @@ static void test(void)
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("Test 53 ");
|
start(53);
|
||||||
|
|
||||||
/* set up signal handler to deal with div by zero */
|
/* set up signal handler to deal with div by zero */
|
||||||
if (setjmp(jmpbuf_main) == 0) {
|
if (setjmp(jmpbuf_main) == 0) {
|
||||||
|
@ -287,6 +276,4 @@ int main(void)
|
||||||
|
|
||||||
/* this was all */
|
/* this was all */
|
||||||
quit();
|
quit();
|
||||||
assert(0); /* not reachable */
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue