#include <hashed_db.h>
#include <transform.h>
-MODULE_ID("$Id: tic.c,v 1.178 2012/10/27 19:57:21 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.182 2012/12/16 00:03:12 tom Exp $")
#define STDIN_NAME "<stdin>"
static void
cleanup(void)
{
+ int rc;
+
#if NO_LEAKS
free_namelist(namelst);
#endif
fclose(tmp_fp);
if (to_remove != 0) {
#if HAVE_REMOVE
- remove(to_remove);
+ rc = remove(to_remove);
#else
- unlink(to_remove);
+ rc = unlink(to_remove);
#endif
+ if (rc != 0)
+ perror(to_remove);
}
}
_nc_STRCPY(filename, "/tmp/XXXXXX", PATH_MAX);
#if HAVE_MKSTEMP
{
+ int oldmask = umask(077);
int fd = mkstemp(filename);
if (fd >= 0)
result = fdopen(fd, "w");
+ umask(oldmask);
}
#else
if (tmpnam(filename) != 0)
return (code);
}
-static const char *
+static char *
valid_db_path(const char *nominal)
{
struct stat sb;
show_databases(const char *outdir)
{
bool specific = (outdir != 0) || getenv("TERMINFO") != 0;
- const char *result;
+ char *result;
const char *tried = 0;
if (outdir == 0) {
}
if ((result = valid_db_path(outdir)) != 0) {
printf("%s\n", result);
+ free(result);
} else {
tried = outdir;
}
if ((outdir = _nc_home_terminfo())) {
if ((result = valid_db_path(outdir)) != 0) {
printf("%s\n", result);
+ free(result);
} else if (!specific) {
tried = outdir;
}