- strncpy (tmpfil, m_tmpfil ("dist"), sizeof(tmpfil));
- if ((txtfd = open (tmpfil, O_RDWR | O_CREAT | O_TRUNC, 0600)) == NOTOK)
- adios (tmpfil, "unable to open temporary file");
+ cp = m_mktemp2(NULL, "dist", &txtfd, NULL);
+ if (cp == NULL) {
+ adios("distsbr", "unable to create temporary file");
+ }
+ fchmod(txtfd, 0600);
+ strncpy (tmpfil, cp, sizeof(tmpfil));