Merge commit '803e82276b3716bf6012ec69e8854dae14a4fd2b'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 7 Sep 2014 22:38:26 +0000 (00:38 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 7 Sep 2014 22:39:26 +0000 (00:39 +0200)
* commit '803e82276b3716bf6012ec69e8854dae14a4fd2b':
  libavformat: Check mkdir return error codes

Conflicts:
libavformat/hdsenc.c
libavformat/smoothstreamingenc.c

See: c89f8f80cc83622471eaf99e451e78df68475e19
See: a3886ea3c5947ca05bfe01b053d9ce2f9725d9eb
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/hdsenc.c
libavformat/smoothstreamingenc.c

index fac5bcf4177395848969aaf1a4d6b208ea8f5c18,882f157d9130a6030e185d8d5adc85198d83a73f..1f77785f95236724ae5d4afe1aa9c5b8b1d612a1
@@@ -329,13 -323,9 +329,10 @@@ static int hds_write_header(AVFormatCon
      int ret = 0, i;
      AVOutputFormat *oformat;
  
-     if (mkdir(s->filename, 0777)) {
-         int is_error = errno != EEXIST;
-         av_log(s, is_error ? AV_LOG_ERROR : AV_LOG_VERBOSE, "Failed to create directory %s\n", s->filename);
-         if (is_error) {
-             ret = AVERROR(errno);
-             goto fail;
-         }
+     if (mkdir(s->filename, 0777) == -1 && errno != EEXIST) {
++        av_log(s, AV_LOG_ERROR , "Failed to create directory %s\n", s->filename);
+         ret = AVERROR(errno);
+         goto fail;
      }
  
      oformat = av_guess_format("flv", NULL, NULL);
index 0781a0a37081dfb99d86d246479ec5d4ebc1c7af,d955b3437e58d53991d02eaa20dc7f6dd0955ef0..d2b7c9e92471bc2783ed27a874912b38325c1011
@@@ -292,8 -292,7 +292,8 @@@ static int ism_write_header(AVFormatCon
      int ret = 0, i;
      AVOutputFormat *oformat;
  
-     if (mkdir(s->filename, 0777) < 0) {
+     if (mkdir(s->filename, 0777) == -1 && errno != EEXIST) {
 +        av_log(s, AV_LOG_ERROR, "mkdir failed\n");
          ret = AVERROR(errno);
          goto fail;
      }
              goto fail;
          }
          snprintf(os->dirname, sizeof(os->dirname), "%s/QualityLevels(%d)", s->filename, s->streams[i]->codec->bit_rate);
-         if (mkdir(os->dirname, 0777) < 0) {
+         if (mkdir(os->dirname, 0777) == -1 && errno != EEXIST) {
              ret = AVERROR(errno);
 +            av_log(s, AV_LOG_ERROR, "mkdir failed\n");
              goto fail;
          }