diff --git a/src/guacenc/video.c b/src/guacenc/video.c index 2dd41f16..b1ff92d8 100644 --- a/src/guacenc/video.c +++ b/src/guacenc/video.c @@ -37,10 +37,11 @@ #include #include #include +#include #include #include -#include #include +#include #include guacenc_video* guacenc_video_alloc(const char* path, const char* codec_name, @@ -166,10 +167,11 @@ guacenc_video* guacenc_video_alloc(const char* path, const char* codec_name, fail_output_file: avio_close(container_format_context->pb); - /* delete the file that was created if it was actually created */ - if (access(path, F_OK) != -1) { - remove(path); - } + + /* Delete the file that was created if it was actually created */ + if (unlink(path) == -1 && errno != ENOENT) + guacenc_log(GUAC_LOG_WARNING, "Failed output file \"%s\" could not " + "be automatically deleted: %s", path, strerror(errno)); fail_output_avio: av_freep(&frame->data[0]);