--- httrack-3.48.3.old/src/htsback.c +++ httrack-3.48.3/src/htsback.c @@ -38,6 +38,7 @@ #include "htsnet.h" #include "htscore.h" #include "htsthread.h" +#include #include /* END specific definitions */ @@ -423,6 +424,42 @@ return (back_index_fetch(opt, sback, adr, fil, sav, /*don't fetch */ 0) >= 0); } +//-------------------------------------------------------------------- + +static char *x_tmpnam (char *buf) +{ + static char xtbuf [80]; // Static pathname buffer + // Note: Exact size isn't critical + + // Offset to last byte of buffer +#define XTBUFLO (-1 + sizeof (xtbuf)) + + // Pointer to last byte of buffer + char *xp = &xtbuf [XTBUFLO]; + char *dp; // Pointer to "tempnam" result + + // Obtain temporary-file pathname + dp = tempnam ("/var/tmp", "temp-"); + + // Copy pathname into buffer + strncpy (xtbuf, dp, sizeof (xtbuf)); + + *xp = '\0'; // Ensure that it's null-terminated + free (dp); // Release dynamic storage + + if (buf != NULL) // Was an output buffer specified? + { // Yes + strcpy (buf, xtbuf); // Copy result into buffer + return (buf); // Return specified pointer + } + + return (xtbuf); // Return pointer to static buffer +} + +#define tmpnam x_tmpnam + +//-------------------------------------------------------------------- + // nombre de sockets en tâche de fond int back_nsoc(struct_back * sback) { lien_back *const back = sback->lnk;