delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/17/18:19:09

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
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 <jan DOT boerhout AT planet DOT nl>
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 <enrico AT adm DOT unipi DOT it>, cygwin AT cygwin DOT com
Subject: Amanda port to Cygwin

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 <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>

#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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019