stress2: Improve cleanup code

This commit is contained in:
Peter Holm 2021-07-02 07:22:18 +02:00
parent 2ce5851295
commit 5bd70f0500

View File

@ -42,11 +42,12 @@ while [ `date '+%s'` -lt $((start + 5 * 60)) ]; do
./mmap3
done
echo "Expect Segmentation faults"
trap "rm -f /tmp/mmap3.0*" EXIT INT
start=`date '+%s'`
while [ `date '+%s'` -lt $((start + 5 * 60)) ]; do
./mmap3 random
done
rm -f mmap3 mmap3.core /tmp/mmap.0*
rm -f mmap3 mmap3.core /tmp/mmap3.0*
exit
EOF
@ -102,7 +103,7 @@ work(int nr)
p = (void *)STARTADDR;
len = ADRSPACE;
sprintf(path, "/tmp/mmap.%06d.%04d", getpid(), nr);
sprintf(path, "/tmp/mmap3.%06d.%04d", getpid(), nr);
if ((fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0622)) == -1)
err(1,"open()");
if (ftruncate(fd, len) == -1)