Browse code

Fix standalone compilation of pipe protocol.

file_check() is not only used by the file protocol, adjust #ifdef accordingly.

Diego Biurrun authored on 2011/05/05 02:20:03
Showing 1 changed files
... ...
@@ -51,6 +51,19 @@ static int file_get_handle(URLContext *h)
51 51
     return (intptr_t) h->priv_data;
52 52
 }
53 53
 
54
+static int file_check(URLContext *h, int mask)
55
+{
56
+    struct stat st;
57
+    int ret = stat(h->filename, &st);
58
+    if (ret < 0)
59
+        return AVERROR(errno);
60
+
61
+    ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ  : 0;
62
+    ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
63
+
64
+    return ret;
65
+}
66
+
54 67
 #if CONFIG_FILE_PROTOCOL
55 68
 
56 69
 static int file_open(URLContext *h, const char *filename, int flags)
... ...
@@ -95,19 +108,6 @@ static int file_close(URLContext *h)
95 95
     return close(fd);
96 96
 }
97 97
 
98
-static int file_check(URLContext *h, int mask)
99
-{
100
-    struct stat st;
101
-    int ret = stat(h->filename, &st);
102
-    if (ret < 0)
103
-        return AVERROR(errno);
104
-
105
-    ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ  : 0;
106
-    ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
107
-
108
-    return ret;
109
-}
110
-
111 98
 URLProtocol ff_file_protocol = {
112 99
     .name                = "file",
113 100
     .url_open            = file_open,