Commit d79c668d authored by Julian Rother's avatar Julian Rother
Browse files

Fixed overwrite check for transcode jobs

parent 4aef5dc0
......@@ -248,7 +248,7 @@ void connect_pads(AVFilterInOut **ins, AVFilterInOut **outs)
int main(int argc, char *argv[])
int err, i, progress, _progress;
char *p, *input, *output, *inpath, *outpath, *tmppath;
char *p, *input, *output, *inpath, *outpath, *tmppath, *oldsrcpath;
AVFormatContext *demux, *mux;
AVCodecContext **decs, **encs;
AVFilterContext **srcs, **sinks;
......@@ -276,7 +276,11 @@ int main(int argc, char *argv[])
output = jlookup(argv[4], "output");
outpath = buildpath(getenv(WORKER_RELEASED), jstr(jlookup(output, "path"), 0));
tmppath = mprintf("%s/.tmp-%i", getenv(WORKER_TMP), jobid);
overwrite_check(outpath, inpath, jstr(jlookup(input, "hash"), ""));
if (oldsrcpath = jstr(jlookup(argv[4], "srcpath"), 0))
oldsrcpath = buildpath(getenv(WORKER_RAW), oldsrcpath);
oldsrcpath = "/var/empty/nosource";
overwrite_check(outpath, oldsrcpath, jstr(jlookup(argv[4], "srchash"), ""));
demux = 0;
opts = 0;
......@@ -361,7 +365,7 @@ int main(int argc, char *argv[])
if (!filesize(tmppath))
job_failed("Sanity check failed: Output file is empty");
overwrite_check(outpath, 0, 0);
overwrite_check(outpath, oldsrcpath, jstr(jlookup(argv[4], "srchash"), ""));
if (rename(tmppath, outpath))
job_failed("Overwriting output file \"%s\" failed: %s", outpath, strerror(errno));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment