Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!psuvax1!vu-vlsi!devon!paul
From: paul@devon.UUCP (Paul Sutcliffe Jr.)
Newsgroups: news.software.b
Subject: Re: 2.11 news src patch #14
Message-ID: <505@devon.UUCP>
Date: Sun, 6-Dec-87 18:37:25 EST
Article-I.D.: devon.505
Posted: Sun Dec  6 18:37:25 1987
Date-Received: Sat, 12-Dec-87 04:02:58 EST
References: <44204@beno.seismo.CSS.GOV>
Organization: Devon Computer Services, Allentown, PA
Lines: 104
Keywords: last one for 1987 (oh yeah?) :-)
Summary: MKDIRSUB bug, and correction (diffs), plus LOCKING trouble

In article <44204@beno.seismo.CSS.GOV>, rick@seismo.CSS.GOV (Rick Adams) writes:
> Description:
> 	This is patch #14 for news 2.11 src. It is expected to be stable
> 	and does not introduce major new features.

In the file "funcs.c", there is the following code fragment:

    #ifdef MKDIRSUB
    /*
     * make a directory. Also make sure that the directory is owned
     * by the right userid
     */
    mkdir(path, perm)
    char *path;
    int perm;
    {
	    [ code deleted ]
    }
    #endif /* !BSD4_2 */

The MKDIRSUB feature was introduced in a previous patch, and has worked
correctly for me until patch 14.  A careful look at the above fragment
tells me that the code for mkdir() will only be included if MKDIRSUB is
defined (in defs.h).  It *should* say

    #ifndef MKDIRSUB
       ^
so that the mkdir() function is included in the source if mkdir is *not*
in libc.a.  I have included a context diff at the end of this article
that corrects this, and corrects the bad comment on the #endif, too.

This problem "found itself" when compiling news, as ld complained that
_mkdir was an unreferenced external.

Rick also said:
> 	LOCKING is an acceptable define for those with the locking() call.

I found that if I defined LOCKING (with or without defining LOCKF) in
defs.h, every .c file compiled with the warning that LOCKING was
redefined.  That's because in params.h, the following occurs:

    #ifdef M_XENIX
    #define LOCKING
    #endif M_XENIX

(Yes, I'm on a Xenix machine.)  Do any other un*xes (sp?) have the
locking() call?  If so, then something like:

    #ifdef M_XENIX
    # ifndef LOCKING
    #  define LOCKING
    # endif LOCKING
    #endif M_XENIX

would be more appropriate.  If only Xenix has it, perhaps the define
should be removed from defs.h as it will surely be defined anyway by
params.h.

Context diffs for the MKDIRSUB bug follow:

*** funcs.c-	Sat Dec  5 20:16:55 1987
--- funcs.c	Sat Dec  5 21:02:13 1987
***************
*** 520,526
  }
  #endif /* VMS */
  
! #ifdef MKDIRSUB
  /*
   * make a directory. Also make sure that the directory is owned
   * by the right userid

--- 520,526 -----
  }
  #endif /* VMS */
  
! #ifndef MKDIRSUB
  /*
   * make a directory. Also make sure that the directory is owned
   * by the right userid
***************
*** 579,585
  #endif
  	return status;
  }
! #endif /* !BSD4_2 */
  
  #ifndef	RENAMESUB
  rename(from,to)

--- 579,585 -----
  #endif
  	return status;
  }
! #endif /* !MKDIRSUB */
  
  #ifndef	RENAMESUB
  rename(from,to)

-- 
Paul Sutcliffe, Jr.

UUCP (smart):  paul@devon.UUCP
UUCP (dumb):   ...{rutgers,ihnp4,cbosgd}!bpa!vu-vlsi!devon!paul