handle some error cases

This commit is contained in:
Wim Taymans 2023-03-16 12:28:29 +01:00
parent c88f841a58
commit 1c18e8aa69
2 changed files with 6 additions and 3 deletions

View File

@ -800,8 +800,10 @@ static int v4l2_openat(int dirfd, const char *path, int oflag, mode_t mode)
if ((file = find_file_by_dev(dev_id)) != NULL) {
res = do_dup(file->fd, 0);
unref_file(file);
if (res >= 0)
fcntl(res, F_SETFL, oflag);
if (res < 0)
return res;
if (fcntl(res, F_SETFL, oflag) < 0)
pw_log_warn("fd:%d failed to set flags: %m", res);
return res;
}

View File

@ -171,7 +171,8 @@ static void node_param(void *data, int seq,
{
uint32_t media_type, media_subtype;
spa_format_parse(param, &media_type, &media_subtype);
if (spa_format_parse(param, &media_type, &media_subtype) < 0)
goto done;
switch(media_type) {
case SPA_MEDIA_TYPE_audio: