PREINSTFILE, POSTINSTFILE, PRERMFILE, POSTRMFILE, 0
};
- char *m, *tmpd, *tmpf;
+ char *m;
const char *debar, *directory, *const *mscriptp, *versionstring, *arch;
char *controlfile;
struct pkginfo *checkedinfo;
struct arbitraryfield *field;
FILE *ar, *gz, *cf;
- int p1[2],p2[2], warns, errs, n, c, subdir, gzfd;
+ int p1[2],p2[2], warns, errs, n, c, subdir;
pid_t c1,c2,c3,c4,c5;
struct stat controlstab, datastab, mscriptstab, debarstab;
char conffilename[MAXCONFFILENAME+1];
execlp(TAR,"tar","-cf","-",".",(char*)0); ohshite(_("failed to exec tar -cf"));
}
close(p1[1]);
-
- if (!(tmpd = getenv("TMPDIR")))
- tmpd= "/tmp";
- tmpf= malloc(strlen(tmpd) + strlen("/dpkg.XXXXXX"));
- strcpy(tmpf, tmpd);
- strcat(tmpf, "/dpkg.XXXXXX");
- if (!(gzfd= mkstemp(tmpf)) || !(gz= fdopen(gzfd, "r+")))
- ohshite(_("failed to make tmpfile (control)"));
-
-
+ if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (control)"));
if (!(c2= m_fork())) {
m_dup2(p1[0],0); m_dup2(fileno(gz),1); close(p1[0]);
execlp(GZIP,"gzip","-9c",(char*)0); ohshite(_("failed to exec gzip -9c"));
if (!oldformatflag) {
fclose(gz);
- strcpy(tmpf, tmpd);
- strcat(tmpf, "/dpkg.XXXXXX");
- if (!(gzfd= mkstemp(tmpf)) || !(gz= fdopen(gzfd, "r+")))
- ohshite(_("failed to make tmpfile (data)"));
+ if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (data)"));
}
- free(tmpf);
m_pipe(p2);
if (!(c4= m_fork())) {
m_dup2(p2[1],1); close(p2[0]); close(p2[1]);
const char **debarp,
const char **directoryp,
int admininfo) {
- char *dbuf;
+ static char dbuf[L_tmpnam];
pid_t c1;
*debarp= *(*argvp)++;
if (!*debarp) badusage(_("--%s needs a .deb filename argument"),cipaction->olong);
- dbuf = tempnam(NULL, "dpkg");
- if (!dbuf) ohshite(_("failed to make temporary filename"));
+ if (!tmpnam(dbuf)) ohshite(_("failed to make temporary filename"));
*directoryp= dbuf;
if (!(c1= m_fork())) {
waitsubproc(c1,"rm -rf",0);
push_cleanup(cu_info_prepare,-1, 0,0, 1, (void*)dbuf);
extracthalf(*debarp, dbuf, "mx", admininfo);
- free(dbuf);
}
static int ilist_select(const struct dirent *de) {