Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3D35ED8D.90102@planet.nl> Date: Thu, 18 Jul 2002 00:19:57 +0200 From: Jan Boerhout User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20011126 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 To: Enrico Bernardini , cygwin AT cygwin DOT com Subject: Amanda port to Cygwin Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Enrico, Some time ago, you reported that your amanda backup client port to Cygwin on Windows98 worked fine and that you were starting with a port to NT. I have started to try and port it to Cygwin on WindowsXP Home, but I am running into difficulties with file descriptor dup() and dup2() in the amandad.exe client (used in dbopen() and main() ). How did you manage to work around that problem? (More info about the simple test below.) Hope someone has a workaround. Should probably join the mailing list... Thanks in advance, Jan When replacing amandad.exe by a simple test (see below), it runs fine when started from the shell command, but fails when started by the inetd service. The test runs fine if DUPPIE is 5 or greater, both from the command shell and via inetd. If DUPPIE is smaller, the executable crashes in dup2() if started by inetd, but runs fine from the command line. #include #include #include #include #define DUPPIE 1 int fd,fe,s; FILE *err, *out; int main() { (void) chdir( "/tmp/amanda"); fd = open( "dup2.out", O_CREAT | O_RDWR ); fe = open( "dup2.err", O_CREAT | O_RDWR ); out = fdopen( fd, "w+" ); err = fdopen( fe, "w+" ); fprintf( err, "in err; DUPPIE: %d\n", DUPPIE) ; fprintf( out, "in out; DUPPIE: %d\n", DUPPIE) ; fflush(err); fflush(out); close( DUPPIE ); s = dup2( fd, DUPPIE ); fprintf( err, "fd,fe,s,errno: %d,%d,%d,%d\n", fd,fe,s, errno ) ; fflush(err); write( DUPPIE, "hello\n", 6 ); close( fd ); close( fe ); } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/