6f949e90b1ba3de976455fbcf9da21897761d134 markd Fri Oct 29 16:11:58 2021 -0700 add timeout option to pipeline to allow kill long-running pipelines, especially ones run from CGIs diff --git src/lib/md5.c src/lib/md5.c index e16fff5..8cef523 100644 --- src/lib/md5.c +++ src/lib/md5.c @@ -24,45 +24,45 @@ { char *pt = hexIn; int i; for (i=0; i<16; ++i) { md5Out[i] = hexToByte(pt); pt += 2; } } char *md5HexForFile(char *fileName) /* Calculate md5 on file and return in hex format. Use freeMem on result when done. */ { /* Calculate md5 using pipeline to unix utility. */ char *cmd[] = {"md5sum", NULL}; -struct pipeline *pl = pipelineOpen1(cmd, pipelineRead, fileName, NULL); +struct pipeline *pl = pipelineOpen1(cmd, pipelineRead, fileName, NULL, 0); FILE *f = pipelineFile(pl); char hex[33]; mustRead(f, hex, 32); hex[32] = 0; pipelineClose(&pl); return cloneString(hex); } char *md5HexForBuf(char *buf, size_t bufSize) /* Return md5 sum of buffer. Use freeMem on result when done. */ { /* Calculate md5 using pipeline to unix utility. */ char *cmd[] = {"md5sum", NULL}; -struct pipeline *pl = pipelineOpenMem1(cmd, pipelineRead, buf, bufSize, fileno(stderr)); +struct pipeline *pl = pipelineOpenMem1(cmd, pipelineRead, buf, bufSize, fileno(stderr), 0); FILE *f = pipelineFile(pl); char hex[33]; mustRead(f, hex, 32); hex[32] = 0; pipelineClose(&pl); return cloneString(hex); } char *md5HexForString(char *string) /* Return md5 sum of zero-terminated string. Use freeMem on result when done. */ { return md5HexForBuf(string, strlen(string)); } void md5ForFile(char *fileName, unsigned char md5[16])