lkml.org 
[lkml]   [1998]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectA testcase for the umount bug.
Date
Here is a testcase for the floppy umount bug:

# su
# gcc foo.c
# a.out
umount: Device or resource busy

Thanks.


--
H.J. Lu (hjl@gnu.org)
---
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>

main ()
{
const char *dirname = "foo";
const char *devname = "/dev/fd0";
char *cp;

rmdir (dirname);

if (mkdir (dirname, 0777))
{
perror ("mkdir");
return 1;
}

if (mount (devname, dirname, "ext2", MS_MGC_VAL, 0))
{
perror ("mount");
return 1;
}

cp = (char *)malloc((size_t)(strlen(dirname) + sizeof("/fill.tmpX")));

if (cp != NULL)
{
(void) strcat(strcpy(cp, dirname), "/fill.tmp1");
(void) unlink(cp);
(void) strcat(strcpy(cp, dirname), "/fill.tmp2");
(void) unlink(cp);
(void) strcat(strcpy(cp, dirname), "/fill.tmp3");
(void) unlink(cp);
(void) strcat(strcpy(cp, dirname), "/fill.dir");
(void) rmdir(cp);
free((void *)cp);
}

if (umount (devname))
{
perror ("umount");
return 1;
}

return 0;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.018 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site