Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!genrad!decvax!harpo!eagle!alice!rabbit!pyuxmm!ggr From: ggr@pyuxmm.UUCP Newsgroups: net.news.b Subject: mkparents() bug in 2.10 inews Message-ID: <460@pyuxmm.UUCP> Date: Sun, 12-Jun-83 18:40:11 EDT Article-I.D.: pyuxmm.460 Posted: Sun Jun 12 18:40:11 1983 Date-Received: Mon, 13-Jun-83 12:12:21 EDT Lines: 38 There is a problem in the code in inews.c to make new newsgroup directories that shows up if, for example, it tries to make the group net.games.trivia and net.games does not already exist. Also directories made by mkparents() end up with the wrong owner. A fix follows. The first bunch of changes are in mknewsg() and the second go at the end of mkparents() if your line numbers are different. === Guy Riddle == BTL Piscataway === 752,753c786 < p = rindex(parent, '/'); < if (p) --- > while(p = rindex(parent, '/')){ 755,757c788,792 < if (stat(parent, &sbuf) < 0) < sbuf.st_mode = 0777; < chmod(parent, 0777); --- > if (stat(parent, &sbuf) == 0){ > chmod(parent, 0777); > break; > } > } 820a856,868 > #ifdef USG > # ifndef CHEAP > /* > * Give away the files we just created, which were assigned to our > * REAL uid. This only works on USG systems. It is an alternative > * to the setuid call above. The directories we just made are owned > * by our real uid, so we have to temporarily set our effective uid > * the same to allow the chown. Fortunately, USG lets us setuid back. > */ > setuid(getuid()); > chown(buf, duid, dgid); > setuid(duid); > # endif