This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]