From 39dba5aa1b919c4b40619895bf3b4936fbe29deb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Mon, 25 Jun 2012 00:39:57 +0300
Subject: [PATCH] network: Include unistd.h from network.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This heaader is required for close() for sockets in network
code. For winsock, the equivalent function is defined in the
winsock2.h header.

This avoids having the HAVE_UNISTD_H in all files dealing with
raw sockets.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavformat/network.h | 4 ++++
 libavformat/sctp.c    | 1 -
 libavformat/tcp.c     | 1 -
 libavformat/udp.c     | 1 -
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/network.h b/libavformat/network.h
index 1dc9deb6758..3e4422e4c2e 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -27,6 +27,10 @@
 #include "libavutil/error.h"
 #include "os_support.h"
 
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #if HAVE_WINSOCK2_H
 #include <winsock2.h>
 #include <ws2tcpip.h>
diff --git a/libavformat/sctp.c b/libavformat/sctp.c
index 07de4986d21..7bcb5ae0a9f 100644
--- a/libavformat/sctp.c
+++ b/libavformat/sctp.c
@@ -39,7 +39,6 @@
 
 #include <netinet/in.h>
 #include <netinet/sctp.h>
-#include <unistd.h>
 
 #include "config.h"
 
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index e77e4c5231e..badc0ba9355 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -20,7 +20,6 @@
  */
 #include "avformat.h"
 #include "libavutil/parseutils.h"
-#include <unistd.h>
 #include "internal.h"
 #include "network.h"
 #include "os_support.h"
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 39db263e12c..71b445b1878 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -30,7 +30,6 @@
 #include "avio_internal.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/avstring.h"
-#include <unistd.h>
 #include "internal.h"
 #include "network.h"
 #include "os_support.h"
-- 
GitLab