swapon02.c used 'wc -l' to get line counts of
/etc/swaps and depends on exact output format of wc,
which were different
between linux 2.6 from linux 2.4.
Suggest to replace line 281-217 in swapon02.c with
swapfile = 0;
if((fd = open("/proc/swaps", O_RDONLY)) == -1) {
printf("Failed to open /proc/swaps\n");
exit(-1);
}
while ((res = read(fd, temp, 16)) > 0) {
for (i = 0; i < res; i++)
if (temp[i] == '\n') swapfile++;
}
(Or chould increase size of temp instead of 16)
Logged In: YES
user_id=160960
I've seen this problem as well where swapon02 hangs the ltp
test. Would be nice if the fix above could be considered for
inclusion.