ulimit bug?
Fred Fish
fnf at estinc.UUCP
Sat Mar 18 05:17:54 AEST 1989
I have discovered that if you set your ulimit to an odd value (1,3,5,etc)
then you cannot write the last block that would be implied by that
ulimit.
For example, set your ulimit to 9 and then run the following program
with "ulimitbug 9":
#include <stdio.h>
main (argc, argv)
int argc;
char *argv[];
{
int fd;
int count;
int status;
int max;
auto char buf[512];
extern int errno;
if (argc != 2) {
printf ("usage: ulimitbug <blockcount>\n");
exit (1);
} else {
max = atoi (argv[1]);
}
if ((fd = creat ("ulimitbugdata", 0666)) == -1) {
perror ("can't open ulimitbugdata");
exit (1);
}
for (count = 0; count < max; count++) {
printf ("block %d", count);
if ((status = write (fd, buf, 512)) != 512) {
printf (", write error; errno = %d", errno);
}
printf ("\n");
}
}
--
# Fred Fish, 1835 E. Belmont Drive, Tempe, AZ 85284, USA
# 1-602-491-0048 asuvax!{nud,mcdphx}!estinc!fnf
More information about the Comp.unix.aux
mailing list