diff options
author | Pav Lucistnik <pav@FreeBSD.org> | 2009-02-18 17:03:44 +0000 |
---|---|---|
committer | Pav Lucistnik <pav@FreeBSD.org> | 2009-02-18 17:03:44 +0000 |
commit | 2aa187699bec7db75024022ec06d264fb3bf70cd (patch) | |
tree | 94d0053b2fde78c06073f0863693de01981e2a30 /net/udpcast/files/patch-udpr-negotiate.c | |
parent | Update to 2.1.9. (diff) |
- Update to 20081213
PR: ports/131561
Submitted by: Leon Kos <leon.kos@lecad.fs.uni-lj.si>
Notes
Notes:
svn path=/head/; revision=228604
Diffstat (limited to 'net/udpcast/files/patch-udpr-negotiate.c')
-rw-r--r-- | net/udpcast/files/patch-udpr-negotiate.c | 59 |
1 files changed, 14 insertions, 45 deletions
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 <unistd.h> +--- 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 <errno.h> + #include <sys/stat.h> +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include <sys/param.h> @@ -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; |