You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ian Kluft <ik...@cisco.com> on 1997/07/13 11:51:50 UTC

[PATCH] Re: again more mod_mime_magic

> From: Marc Slemko <ma...@worldgate.com>
> In mod_mime_magic, there are a couple of NOTREACHED comments that don't
> make sense to me.  eg.

Hmmm... <shuffle, shuffle>  OK, I did a little digging to trace the origin
of those.  I tracked them down to ones which used to follow calls to an
error() function in the original program, which called exit().  I missed
the NOTREACHED's when turning the error() calls into Apache logging calls.

So they can go.  Now that you brought this up, I checked all the uses of
NOTREACHED and found two more unnecessary ones.  Tested patch attached...
This patch is relative to the 19970713070021 snapshot, although we still
have our two patches from Friday not yet committed to CVS.  (This patches
cleanly with or without them.)  Recap of pending mod_mime_magic patches:
   Subject: [PATCH] mod_mime_magic cleanup [Marc Slemko]
      +1 me, +1 Jim Jagielski
   Subject: more mod_mime_magic cleanup [Ian Kluft]
      +1 Jim Jagielski
   Subject: [PATCH] Re: again more mod_mime_magic [Ian Kluft]
      (in this message)

Marc - Thanks for the time you're putting into this.  It does help to have
another pair of eyes to go through the code.  The file(1) program was 2500
lines of 1987-vintage code.  If you compare with the original, you can see
a lot was done to transform it into an Apache module.  But it's still a lot
of code and any assistance such as yours and Dean's is appreciated.

Here's the URL of the file(1) archive in case it helps to answer questions
about the origin of any other relics like the ones you found.
   http://wuarchive.wustl.edu/usenet/comp.sources.unix/volume13/file/
-- 
Ian Kluft  KO6YQ PP-ASEL                                  Cisco Systems, Inc.
ikluft@cisco.com (work)  ikluft@thunder.sbay.org (home)          San Jose, CA

------------------------------------------------------------------------------
*** mod_mime_magic.c.orig	Sat Jul 12 18:00:14 1997
--- mod_mime_magic.c	Sun Jul 13 02:04:33 1997
***************
*** 905,911 ****
       */
      if ((nbytes = read(fd, (char *) buf, HOWMANY)) == -1) {
          log_printf(r->server, "read failed (%s).", strerror(errno));
-         /* NOTREACHED */
      }
  
      if (nbytes == 0)
--- 905,910 ----
***************
*** 1600,1606 ****
      default:
          log_printf(r->server, "%s: invalid mode 0%o.", MODNAME,
                 sb->st_mode);
-         /* NOTREACHED */
      }
  
      /*
--- 1599,1604 ----
***************
*** 2003,2009 ****
      default:
          log_printf(r->server, "%s: invalid type %d in mcheck().",
                 MODNAME, m->type);
!         return 0;    /* NOTREACHED */
      }
  
      v = signextend(r->server, m, v) & m->mask;
--- 2001,2007 ----
      default:
          log_printf(r->server, "%s: invalid type %d in mcheck().",
                 MODNAME, m->type);
!         return 0;
      }
  
      v = signextend(r->server, m, v) & m->mask;
***************
*** 2083,2089 ****
      default:
          matched = 0;
          log_printf(r->server, "%s: mcheck: can't happen: invalid relation %d.", MODNAME, m->reln);
!         break;        /* NOTREACHED */
      }
  
      return matched;
--- 2081,2087 ----
      default:
          matched = 0;
          log_printf(r->server, "%s: mcheck: can't happen: invalid relation %d.", MODNAME, m->reln);
!         break;
      }
  
      return matched;

Re: [PATCH] Re: again more mod_mime_magic

Posted by Dean Gaudet <dg...@arctic.org>.

On Sun, 13 Jul 1997, Ian Kluft wrote:

> Hmmm... <shuffle, shuffle>  OK, I did a little digging to trace the origin
> of those.  I tracked them down to ones which used to follow calls to an
> error() function in the original program, which called exit().  I missed
> the NOTREACHED's when turning the error() calls into Apache logging calls.

If they exit()d in the original code shouldn't it return DECLINED or some
error in the apache code?  i.e. is the code that they fall through to
really expecting to be in that condition? 

Dean