|
|
} | } |
| |
/* create the temporary file names */ | /* create the temporary file names */ |
pid = getpid(); |
do { |
(void) sprintf(temp1, "%s/cscope%d.1", tmpdir, pid); |
char *tempfile = tempnam(tmpdir, "cscope1"); |
(void) sprintf(temp2, "%s/cscope%d.2", tmpdir, pid); |
if (!tempfile) { |
|
fputs ("Can't create tempfile\n", stderr); |
|
exit (1); |
|
} |
|
if (strlen(tempfile) >= sizeof(temp1)) { |
|
fputs ("TMPDIR path is too long\n", stderr); |
|
exit(1); |
|
} |
|
strncpy (temp1, tempfile, sizeof (temp1)); |
|
} while (open (temp1, O_CREAT|O_EXCL|O_WRONLY, 0600) < 0); |
|
do { |
|
char *tempfile = tempnam(tmpdir, "cscope2"); |
|
if (!tempfile) { |
|
fputs ("Can't create tempfile\n", stderr); |
|
exit (1); |
|
} |
|
if (strlen(tempfile) >= sizeof(temp2)) { |
|
fputs ("TMPDIR path is too long\n", stderr); |
|
exit(1); |
|
} |
|
strncpy (temp2, tempfile, sizeof (temp2)); |
|
} while (open (temp2, O_CREAT|O_EXCL|O_WRONLY, 0600) < 0); |
|
|
| |
/* if running in the foreground */ | /* if running in the foreground */ |
if (signal(SIGINT, SIG_IGN) != SIG_IGN) { | if (signal(SIGINT, SIG_IGN) != SIG_IGN) { |