diff mbox

[FFmpeg-devel,5/5] avformat/utils: Fix always true check

Message ID 20190916155502.17579-5-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt Sept. 16, 2019, 3:55 p.m. UTC
Found via PVS-Studio (ticket #8156).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 17, 2019, 11:16 a.m. UTC | #1
On Mon, Sep 16, 2019 at 05:55:02PM +0200, Andreas Rheinhardt wrote:
> Found via PVS-Studio (ticket #8156).
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index b83a740500..1cd7aa211c 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4837,7 +4837,7 @@ int ff_mkdir_p(const char *path)
>          }
>      }
>  
> -    if ((*(pos - 1) != '/') || (*(pos - 1) != '\\')) {
> +    if ((*(pos - 1) != '/') && (*(pos - 1) != '\\')) {
>          ret = mkdir(temp, 0755);
>      }

This should probably check for HAVE_DOS_PATH

thx

[...]
diff mbox

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index b83a740500..1cd7aa211c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4837,7 +4837,7 @@  int ff_mkdir_p(const char *path)
         }
     }
 
-    if ((*(pos - 1) != '/') || (*(pos - 1) != '\\')) {
+    if ((*(pos - 1) != '/') && (*(pos - 1) != '\\')) {
         ret = mkdir(temp, 0755);
     }