View Full Version : The mount function

01-13-2003, 08:05 PM

Can anyone help me with this?

This is the code:

ret = mount(DEVICE_FILE, MOUNT_DIR, "vfat", MS_MGC_VAL, NULL);

I have all of the values figured out except MS_MGC_VAL. It is an unsigned long int passed to the mount function and is used for a read/write flag.

This is the error:

hda: hda1
hda: hda1
[Error] Can not Open conftest
[Error] Testing all
Segmentation fault
[root@Linux /root]$mount
/dev/ram0 on / type ext2 (rw)
/proc on /proc type proc (rw)
none on /dev/pts type devpts (rw)
/dev/hda1 on /flash type vfat (rw)
[root@Linux /root]$

As you can see the drive does get mounted in the code. I can read and write to it after the program has exited. The drive was not mounted before executing the program.

I can't figure out what this value should be set at or if this is the problem.

Thanks for any help,


01-13-2003, 08:38 PM
Did you try reading errno? It is there for a reason.

01-13-2003, 08:39 PM
Just take a look at the man page (http://www.rt.com/man/mount.2.html) for said function...

If the magic number is absent, then the last two arguments are not used