From 2aa187699bec7db75024022ec06d264fb3bf70cd Mon Sep 17 00:00:00 2001 From: Pav Lucistnik Date: Wed, 18 Feb 2009 17:03:44 +0000 Subject: - Update to 20081213 PR: ports/131561 Submitted by: Leon Kos --- net/udpcast/files/patch-udpr-negotiate.c | 59 ++++++++------------------------ 1 file changed, 14 insertions(+), 45 deletions(-) (limited to 'net/udpcast/files/patch-udpr-negotiate.c') diff --git a/net/udpcast/files/patch-udpr-negotiate.c b/net/udpcast/files/patch-udpr-negotiate.c index db9f50ba147d..c1a1fddbd386 100644 --- a/net/udpcast/files/patch-udpr-negotiate.c +++ b/net/udpcast/files/patch-udpr-negotiate.c @@ -1,8 +1,8 @@ ---- udpr-negotiate.c.orig Sat Feb 21 14:08:49 2004 -+++ udpr-negotiate.c Tue Jul 20 13:44:05 2004 -@@ -2,6 +2,10 @@ - #include +--- udpr-negotiate.c.orig 2007-05-25 12:01:59.000000000 +0200 ++++ udpr-negotiate.c 2009-02-06 08:18:02.000000000 +0100 +@@ -3,6 +3,10 @@ #include + #include +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include @@ -11,50 +11,19 @@ #include "log.h" #include "socklib.h" #include "udpcast.h" -@@ -16,6 +20,10 @@ - # define O_BINARY 0 - #endif - -+#ifdef __FreeBSD__ -+struct client_config client_config_on_exit_hack; -+#endif -+ - static int sendConnectReq(struct client_config *client_config, - struct net_config *net_config, - int haveServerAddress) { -@@ -48,6 +56,12 @@ - sendDisconnect(exitStatus, (struct client_config *) args); - } - -+#ifdef __FreeBSD__ -+static void sendDisconnectWrapper_on_exit_handler() { -+ sendDisconnectWrapper(0, &client_config_on_exit_hack); -+} -+#endif -+ - void sendDisconnect(int exitStatus, - struct client_config *client_config) { - int endianness = client_config->endianness; -@@ -144,7 +158,7 @@ +@@ -82,13 +86,13 @@ if(disk_config->fileName != NULL) { int oflags = O_CREAT | O_WRONLY; - if(!(disk_config->flags & FLAG_NOSYNC)) { + if((disk_config->flags & FLAG_SYNC)) { - oflags |= O_SYNC; + oflags |= O_FSYNC; + } else if( !(disk_config->flags & FLAG_NOSYNC)) { + struct stat buf; + if(stat(disk_config->fileName, &buf) == 0) { + /* If target is device, open it synchronously */ + if(S_ISCHR(buf.st_mode) || S_ISBLK(buf.st_mode)) +- oflags |= O_SYNC; ++ oflags |= O_FSYNC; + } } outFile = open(disk_config->fileName, oflags | O_BINARY, 0644); - if(outFile < 0) { -@@ -333,7 +347,13 @@ - pipedOutFile = openPipe(client_config.toServer, outFile, disk_config, - &pipePid); - #ifndef __CYGWIN__ -+# ifdef __FreeBSD__ -+ client_config_on_exit_hack = client_config; -+ -+ atexit(sendDisconnectWrapper_on_exit_handler); -+# else - on_exit(sendDisconnectWrapper, &client_config); -+# endif - #endif - { - struct fifo fifo; -- cgit v1.2.3