From patchwork Tue Jun 18 10:45:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 13598 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7311D449C02 for ; Tue, 18 Jun 2019 13:51:39 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4039968A905; Tue, 18 Jun 2019 13:51:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18151680BAA for ; Tue, 18 Jun 2019 13:51:32 +0300 (EEST) Received: by mail-pf1-f196.google.com with SMTP id 81so7425226pfy.13 for ; Tue, 18 Jun 2019 03:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3MpQVBSzKXMaCxfaO7pwPlNNhhgoBn5LS20ElXsn/ks=; b=duh5Ojr/DaQc3nHaLswcFCJC4GGhfeZTq2r9o6XO/u0oMGXmgnfz6BtG7gV5aOf/qF 58I+2FdHbIgfTjCakLramv6VKRDEmZDZML3mSY7FaIZVXf7zWriSgf9f1Y5KIT+5Q7xP +slxBAsBlsGx+Pvxch5eWtqPqRdeDtjYdSpgryuS8KPIlyhI/C3XydtyLwxVyD78kLp4 WMEtGUtfERLf1wMOwNZOZUzWwwf6g1HQXvsMNPyWLBaXNSnQDtt95eq6a4aUExv1UJvL KQsh+4uoBuM0hi6SlyCcIK9ShPEZM16/IfYGYUC+AUeAmDWxNZN3N7xwYSdWUvtwxVid vxrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3MpQVBSzKXMaCxfaO7pwPlNNhhgoBn5LS20ElXsn/ks=; b=hkUB0Wp+ppOUxi/HL4wTYWScYM4sMtzSxU3e21joefI2qEdqlSIVFWOJ0M76cKzcgf NEuFi/BHoYt3x2s0E5OwfCngC7Sn2+YaZqxx2ngLrK9AvZyGDEskkIyqE+g0jcgCKJrQ 9xT0V/hr7d7udDP/nbVv3JxTtfZYvpPZsnnJzQPNlvJG7wJwyJ8w+aMJUcdv8NRsO7id NuZr/M4YR3clVUO26H0I/WA6OoSShKu9EuVGnUjAenf0qB5kbzlpy78iwpCani7PK9+W 0Eu/YP5NFF+7hdALv9QMRyOzsVxCs9bpSydrWcYKYaeVShim9q9VjRSYnyjOupk1LTna GGAw== X-Gm-Message-State: APjAAAVDEOswIVmSsaXVOWS93mCXXG6kQnCbOUmBa0eUpyE2A2TtakR7 0G1h6NilIC17CIhoJiZcdU/fX62u3gU= X-Google-Smtp-Source: APXvYqyVqCIG+EEFrJZsafscqP811JcJJWqx0Oovn5fsEqEU5Xi0eBAJdH/xDyUS51HZiy6A9LlOoA== X-Received: by 2002:a17:90a:3210:: with SMTP id k16mr4256391pjb.13.1560854742514; Tue, 18 Jun 2019 03:45:42 -0700 (PDT) Received: from localhost.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id 139sm14972048pfw.152.2019.06.18.03.45.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Jun 2019 03:45:41 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Jun 2019 18:45:13 +0800 Message-Id: <20190618104513.19549-2-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190618104513.19549-1-lance.lmwang@gmail.com> References: <20190618104513.19549-1-lance.lmwang@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 2/2] libavformat/file: initilize the fd to -1 instead of 0(valid fd) in case unexpected file close X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/file.c b/libavformat/file.c index 08c7f8e6dd..40ae9ad2a8 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -274,6 +274,7 @@ static int file_open_dir(URLContext *h) #if HAVE_LSTAT FileContext *c = h->priv_data; + c->fd = -1; c->dir = opendir(h->filename); if (!c->dir) return AVERROR(errno);