Unified · Split
| @@ -299,10 +299,16 @@ static int open_f(stream_t *stream, const struct stream_open_args *args) · 298 unmodified lines | |||
| 299 | if (strncmp(url, "fd://", 5) == 0 || is_fdclose) { | 299 | if (strncmp(url, "fd://", 5) == 0 || is_fdclose) { |
| 300 | char *begin = strstr(stream->url, "://") + 3, *end = NULL; | 300 | char *begin = strstr(stream->url, "://") + 3, *end = NULL; |
| 301 | p->fd = strtol(begin, &end, 0); | 301 | p->fd = strtol(begin, &end, 0); |
| 302 | if (!end || end == begin || end[0]) { | 302 | if (!end || end == begin || end[0] || p->fd < 0) { |
| 303 | MP_ERR(stream, "Invalid FD: %s\n", stream->url); | 303 | MP_ERR(stream, "Invalid FD number: %s\n", stream->url); |
| 304 | return STREAM_ERROR; | 304 | return STREAM_ERROR; |
| 305 | } | 305 | } |
| 306 | #ifdef F_SETFD | ||
| 307 | if (fcntl(p->fd, F_GETFD) == -1) { | ||
| 308 | MP_ERR(stream, "Invalid FD: %d\n", p->fd); | ||
| 309 | return STREAM_ERROR; | ||
| 310 | } | ||
| 311 | #endif | ||
| 306 | if (is_fdclose) | 312 | if (is_fdclose) |
| 307 | p->close = true; | 313 | p->close = true; |
| 308 | } else if (!strict_fs && !strcmp(filename, "-")) { | 314 | } else if (!strict_fs && !strcmp(filename, "-")) { |