Greetings!  The issue here is in mount_ext2.c, where fsck is called
with -p when mounting a local ext2 filesystem.  For readonly
filesystems, that fsck flag should be -n.  Here is a patch which works
here.  Is there any objection to using this patch in the
soon-to-be-released Debian distribution?

--- autofs-3.1.4.orig/modules/mount_ext2.c
+++ autofs-3.1.4/modules/mount_ext2.c
@@ -41,7 +41,8 @@
                void *context)
 {
   char *fullpath;
-  int err;
+  const char *p,*p1=NULL,*rflag;
+  int err,ro;
 
   fullpath = alloca(strlen(root)+name_len+2);
   if ( !fullpath ) {
@@ -56,14 +57,23 @@
     return 1;
   }
 
-  syslog(LOG_DEBUG, MODPREFIX "calling fsck.ext2 -p %s", what);
-  err = spawnl(LOG_DEBUG, PATH_E2FSCK, PATH_E2FSCK, "-p", what, NULL);
+  ro=0;
+  for (p=options;p && (p1=strchr(p,','));p=p1+1) 
+    if (!strncmp(p,"ro",p1-p))
+      ro=1;
+  if (p && !strcmp(p,"ro"))
+    ro=1;
+
+  rflag=ro ? "-n" : "-p";
+
+  syslog(LOG_DEBUG, MODPREFIX "calling fsck.ext2 %s %s", rflag,what);
+  err = spawnl(LOG_DEBUG, PATH_E2FSCK, PATH_E2FSCK, rflag, what, NULL);
   if ( err & ~7 ) {
     syslog(LOG_ERR, MODPREFIX "%s: filesystem needs repair, won't mount",
           what);
     return 1;
   }
-    
+  
   if ( options ) {
     syslog(LOG_DEBUG, MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
           fstype, options, what, fullpath);


Take care,

-- 
Camm Maguire                                            [EMAIL PROTECTED]
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

Reply via email to