On Wed, Jun 29, 2005 at 09:45:39AM +0200, Michael Petuschak wrote: > Looking at source code I now think you are checking for this specifically in > MirrorJob::va_Report > > pid_t p=tcgetpgrp(fileno(stdout)); > if(p!=-1 && p!=getpgrp()) > return; > > I assume this means lftp won't print anything when there is no controlling > terminal and there is no controlling terminal for processess run by cron.
Not quite. It won't print when there _is_ a controlling terminal and lftp is not in foreground process group. In fact, when lftp is run under cron the stdout is not a terminal at all. So I assumed that when a file is not a terminal, then tcgetpgrp should return -1 and the report line will be output. Probably FreeBSD works differently. A quote from man page: } RETURN VALUES } Upon successful completion, tcgetpgrp() returns the value of } the process group ID of the foreground process associated } with the terminal. Otherwise, -1 is returned and errno is } set to indicate the error. } } ERRORS } The tcgetpgrp() function will fail if: } } EBADF The fildes argument is not a valid file descriptor. } } ENOTTY } The calling process does not have a controlling termi- } nal, or the file is not the controlling terminal. So tcgetpgrp should return -1 and set errno to ENOTTY. If FreeBSD does not do this, it is a bug. -- Alexander..
