version 1.4, 2005/12/27 04:28:08 |
version 1.5, 2005/12/27 04:31:06 |
|
|
|
|
/* If we don't write anything to the file, just close. */ |
/* If we don't write anything to the file, just close. */ |
if (s == NULL) { |
if (s == NULL) { |
if (close(fd)) { |
close(fd); |
warn("could not close %s", filename); |
|
cleanup(filename); |
|
/* NOTREACHED */ |
|
} |
|
|
|
return (filename); |
return (filename); |
} |
} |
|
|
} |
} |
|
|
/* Close temp file. */ |
/* Close temp file. */ |
if (fclose(file)) { |
fclose(file); |
warn("could not close %s", filename); |
|
cleanup(filename); |
|
/* NOTREACHED */ |
|
} |
|
|
|
return (filename); |
return (filename); |
} |
} |
|
|
/* We've reached the end of the temporary file, so remove it. */ |
/* We've reached the end of the temporary file, so remove it. */ |
if (unlink(filename)) |
if (unlink(filename)) |
warn("could not delete: %s", filename); |
warn("could not delete: %s", filename); |
if (fclose(file)) |
fclose(file); |
warn("could not close: %s", filename); |
|
|
|
/* filename was malloc()ed in xmktemp(). */ |
/* filename was malloc()ed in xmktemp(). */ |
free((void *)filename); |
free((void *)filename); |