[PATCH] subfs
Ludwig Nussel
ludwig.nussel at gmx.de
Sat Apr 17 15:34:42 EDT 2004
Hi,
SUSE 9.1 uses subfs to automatically mount removable media.
Unfortunately subfs mounted CD-ROMs don't appear in /etc/mtab so
loki-setup doesn't find them. A subfs line in /etc/fstab looks like
this:
/dev/cdrom /media/cdrom subfs fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8 0 0
ut2004 installation works with the following patch:
Index: loki_setup/detect.c
===================================================================
--- loki_setup.orig/detect.c 2004-04-17 18:27:01.456734874 +0200
+++ loki_setup/detect.c 2004-04-17 18:27:12.427395593 +0200
@@ -580,17 +580,20 @@
mountfp = setmntent(MOUNTS_FILE, "r" );
if( mountfp != NULL ) {
while( (mntent = getmntent( mountfp )) != NULL && num_cdroms < SETUP_MAX_DRIVES){
- char *tmp, mntdev[1024], mnt_type[32];
+ char *tmp, mntdev[1024], mnt_type[1024];
if ( strncmp(mntent->mnt_fsname, DEVICE_FLOPPY, strlen(DEVICE_FLOPPY)) == 0)
continue;
- strcpy(mntdev, mntent->mnt_fsname);
- strcpy(mnt_type, mntent->mnt_type);
+#define XXXstrcpy(d,s) \
+ do { strncpy(d,s,sizeof(d)); d[sizeof(d)-1] = '\0'; } while(0);
+
+ XXXstrcpy(mntdev, mntent->mnt_fsname);
+ XXXstrcpy(mnt_type, mntent->mnt_type);
if ( strcmp(mnt_type, MNTTYPE_SUPER) == 0 ) {
tmp = strstr(mntent->mnt_opts, "fs=");
if ( tmp ) {
- strcpy(mnt_type, tmp+strlen("fs="));
+ XXXstrcpy(mnt_type, tmp+strlen("fs="));
tmp = strchr(mnt_type, ',');
if ( tmp ) {
*tmp = '\0';
@@ -598,7 +601,7 @@
}
tmp = strstr(mntent->mnt_opts, "dev=");
if ( tmp ) {
- strcpy(mntdev, tmp+strlen("dev="));
+ XXXstrcpy(mntdev, tmp+strlen("dev="));
tmp = strchr(mntdev, ',');
if ( tmp ) {
*tmp = '\0';
@@ -606,14 +609,28 @@
}
}
+ if ( strcmp(mnt_type, "subfs") == 0 ) {
+ tmp = strstr(mntent->mnt_opts, "fs=");
+ if ( tmp ) {
+ XXXstrcpy(mnt_type, tmp+strlen("fs="));
+ tmp = strchr(mnt_type, ',');
+ if ( tmp ) {
+ *tmp = '\0';
+ }
+ }
+ if(!strcmp(mnt_type, "cdfss"))
+ XXXstrcpy(mnt_type, MNTTYPE_CDROM);
+ }
+
tmp = strstr(mntent->mnt_opts, "loop=");
if ( tmp ) {
- strcpy(mntdev, tmp+strlen("loop="));
+ XXXstrcpy(mntdev, tmp+strlen("loop="));
tmp = strchr(mntdev, ',');
if ( tmp ) {
*tmp = '\0';
}
}
+#undef XXXstrcpy
if( strncmp(mntdev, "/dev", 4) ||
realpath(mntdev, mntdevpath) == NULL ) {
cu
Ludwig
--
(o_ Ludwig.Nussel at gmx.de
//\ PGP Key ID: FF8135CE
V_/_ ICQ: 52166811
More information about the Lokisetup
mailing list