Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 Apollo 1/28/85; site apollo.uucp
Path: utzoo!watmath!clyde!cbosgd!ulysses!allegra!mit-eddie!genrad!decvax!wanginst!apollo!rees
From: rees@apollo.uucp (Jim Rees)
Newsgroups: net.news.b
Subject: fix for inews.c to use mkdir()
Message-ID: <24ba4d3e.1de6@apollo.uucp>
Date: Tue, 12-Feb-85 08:33:24 EST
Article-I.D.: apollo.24ba4d3e.1de6
Posted: Tue Feb 12 08:33:24 1985
Date-Received: Thu, 14-Feb-85 01:33:13 EST
Organization: Apollo Computer, Chelmsford, Mass.
Lines: 79

If you are running 4.2bsd, you can avoid some tacky code in inews.c
by calling mkdir() instead of system("mkdir").  Here is the fix.

***************
*** 733,738
  	if (ngname == NULL || !isalpha(ngname[0]))
  		xerror("Tried to make illegal newsgroup %s", ngname);
  
  	/*
  	 * If the parent is 755 and we're on a USG system, the setuid(getuid)
  	 * will fail, and since mkdir is suid, and our real uid is random,

--- 737,749 -----
  	if (ngname == NULL || !isalpha(ngname[0]))
  		xerror("Tried to make illegal newsgroup %s", ngname);
  
+ #ifdef BSD4_2
+ 	mkparents(fulldir);
+ 	if (mkdir(fulldir, 0777) < 0) {
+ 		sprintf(sysbuf, "Cannot mkdir %s", fulldir);
+ 		xerror(sysbuf);
+ 	}
+ #else BSD4_2
  	/*
  	 * If the parent is 755 and we're on a USG system, the setuid(getuid)
  	 * will fail, and since mkdir is suid, and our real uid is random,
***************
*** 787,792
  	setuid(duid);
  # endif
  #endif
  
  	/* Update the "active newsgroup" file, unless it's already there */
  	if (validng(ngname) == 0) {

--- 798,804 -----
  	setuid(duid);
  # endif
  #endif
+ #endif BSD4_2
  
  	/* Update the "active newsgroup" file, unless it's already there */
  	if (validng(ngname) == 0) {
***************
*** 815,820
  	if (exists(buf))
  		return;
  	mkparents(buf);
  	sprintf(sysbuf, "mkdir %s", buf);
  	system(sysbuf);
  }

--- 827,835 -----
  	if (exists(buf))
  		return;
  	mkparents(buf);
+ #ifdef BSD4_2
+ 	mkdir(buf, 0777);
+ #else BSD4_2
  	sprintf(sysbuf, "mkdir %s", buf);
  	system(sysbuf);
  #endif BSD4_2
***************
*** 817,822
  	mkparents(buf);
  	sprintf(sysbuf, "mkdir %s", buf);
  	system(sysbuf);
  }
  
  cancel()

--- 832,838 -----
  #else BSD4_2
  	sprintf(sysbuf, "mkdir %s", buf);
  	system(sysbuf);
+ #endif BSD4_2
  }
  
  cancel()