Re: [Queue-developers] Minor new CVS release
Brought to you by:
wkrebs
From: Mike C. <da...@ix...> - 2001-05-12 06:07:48
|
On Fri, May 11, 2001 at 09:03:48PM -0400, Werner G. Krebs wrote: > This new CVS release addresses a number of minor compiliation, > installation, and documentation issues since 1.40.1 beta. A simple "queue -- hostname" results in the following email: Date: Fri, 11 May 2001 22:43:50 -0700 To: ro...@mr... From: The Queue Daemon <ro...@mr...> Subject: queued error on mars.mrc-home.org: 'now/efm801954155': fchown(1, 501, +100) failed: Bad file descriptor 'now/efm801954155': fchown(1, 501, 100) failed: Bad file descriptor Which is caused by this bit of code: /* This creates a file owned by the user. This means the user can * write into this file, so the user can start a long-sleeping batch * job and use this file for non-quota storage, but then the user * could do that with the user-owned input file too... If this * fails, well, too bad; keep going. -IAN! */ if( fchown(1, pw->pw_uid, pw->pw_gid) == -1 ){ mperror3("'%s': fchown(1, %d, %d) failed", fname, pw->pw_uid, pw->pw_gid ); /* no exit; just keep going */ } I think this is not valid. Slightly above this code, we have: /* * Close all (but debug_fd) file descriptors and open them as follows: * 0 - /dev/null * 1 - if (debug) then redirect output to debugfile, otherwise don't care. * 2 - if (debug) then redirect output to debugfile, otherwise don't care. */ for (i = getdtablesize(); i--;) {if (i != debug_fd) close(i);} So, I think it should be changed from fchown(1, to chown(fname, . The following patch seems to work: Index: queued.c =================================================================== RCS file: /cvsroot/queue/queue-development/queued.c,v retrieving revision 1.48 diff -u -r1.48 queued.c --- queued.c 2001/05/11 22:49:59 1.48 +++ queued.c 2001/05/12 06:06:42 @@ -3739,8 +3739,8 @@ * could do that with the user-owned input file too... If this * fails, well, too bad; keep going. -IAN! */ - if( fchown(1, pw->pw_uid, pw->pw_gid) == -1 ){ - mperror3("'%s': fchown(1, %d, %d) failed", + if( chown(fname, pw->pw_uid, pw->pw_gid) == -1 ){ + mperror3("chown(%s, %d, %d) failed", fname, pw->pw_uid, pw->pw_gid ); /* no exit; just keep going */ } mrc -- Mike Castle Life is like a clock: You can work constantly da...@ix... and be right all the time, or not work at all www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc We are all of us living in the shadow of Manhattan. -- Watchmen |