Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 71595 | Differences between
and this patch

Collapse All | Expand All

(-)./cscope-15.5/src/global.h (-1 / +1 lines)
Lines 241-247 Link Here
241
extern	long	totalterms;	/* total inverted index terms */
241
extern	long	totalterms;	/* total inverted index terms */
242
extern	BOOL	trun_syms;	/* truncate symbols to 8 characters */
242
extern	BOOL	trun_syms;	/* truncate symbols to 8 characters */
243
extern	char	tempstring[8192]; /* global dummy string buffer */
243
extern	char	tempstring[8192]; /* global dummy string buffer */
244
extern	char	*tmpdir;	/* temporary directory */
244
extern	char	tmpdir[2048];	/* temporary directory */
245
245
246
/* command.c global data */
246
/* command.c global data */
247
extern	BOOL	caseless;	/* ignore letter case when searching */
247
extern	BOOL	caseless;	/* ignore letter case when searching */
(-)./cscope-15.5/src/main.c (-4 / +21 lines)
Lines 105-111 Link Here
105
BOOL	trun_syms;		/* truncate symbols to 8 characters */
105
BOOL	trun_syms;		/* truncate symbols to 8 characters */
106
char	tempstring[8192];	/* use this as a buffer, instead of 'yytext', 
106
char	tempstring[8192];	/* use this as a buffer, instead of 'yytext', 
107
				 * which had better be left alone */
107
				 * which had better be left alone */
108
char	*tmpdir;		/* temporary directory */
108
char	tmpdir[2048];		/* temporary directory */
109
109
110
static	BOOL	onesearch;		/* one search only in line mode */
110
static	BOOL	onesearch;		/* one search only in line mode */
111
static	char	*reflines;		/* symbol reference lines file */
111
static	char	*reflines;		/* symbol reference lines file */
Lines 312-319 Link Here
312
	shell = mygetenv("SHELL", SHELL);
312
	shell = mygetenv("SHELL", SHELL);
313
	lineflag = mygetenv("CSCOPE_LINEFLAG", LINEFLAG);
313
	lineflag = mygetenv("CSCOPE_LINEFLAG", LINEFLAG);
314
	lineflagafterfile = getenv("CSCOPE_LINEFLAG_AFTER_FILE")?1:0;
314
	lineflagafterfile = getenv("CSCOPE_LINEFLAG_AFTER_FILE")?1:0;
315
	tmpdir = mygetenv("TMPDIR", TMPDIR);
316
315
316
	char template[] = "cscope.XXXXXX";
317
	snprintf(tmpdir, sizeof(tmpdir), "%s/%s", mygetenv("TMPDIR", TMPDIR), template);
318
	tmpdir[sizeof(tmpdir)-1] = '\0';
319
	char *ret;
320
	ret = mkdtemp(tmpdir);
321
	if (ret == NULL)
322
	{
323
		fprintf (stderr, "cscope: Temporary directory %s cannot be created.\n", tmpdir);
324
		myexit(1);
325
	}
326
	
317
	/* XXX remove if/when clearerr() in dir.c does the right thing. */
327
	/* XXX remove if/when clearerr() in dir.c does the right thing. */
318
	if (namefile && strcmp(namefile, "-") == 0 && !buildonly)
328
	if (namefile && strcmp(namefile, "-") == 0 && !buildonly)
319
	{
329
	{
Lines 331-338 Link Here
331
341
332
	/* create the temporary file names */
342
	/* create the temporary file names */
333
	pid = getpid();
343
	pid = getpid();
334
	(void) sprintf(temp1, "%s/cscope%d.1", tmpdir, pid);
344
	(void) snprintf(temp1, sizeof(temp1), "%s/cscope%d.1", tmpdir, pid);
335
	(void) sprintf(temp2, "%s/cscope%d.2", tmpdir, pid);
345
	temp1[sizeof(temp1)-1] = '\0';
346
	(void) snprintf(temp2, sizeof(temp1), "%s/cscope%d.2", tmpdir, pid);
347
	temp2[sizeof(temp2)-1] = '\0';
336
348
337
	/* if running in the foreground */
349
	/* if running in the foreground */
338
	if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
350
	if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
Lines 825-830 Link Here
825
void
837
void
826
myexit(int sig)
838
myexit(int sig)
827
{
839
{
840
	int retval;
828
	/* HBB 20010313; close file before unlinking it. Unix may not care
841
	/* HBB 20010313; close file before unlinking it. Unix may not care
829
	 * about that, but DOS absolutely needs it */
842
	 * about that, but DOS absolutely needs it */
830
	if (refsfound != NULL)
843
	if (refsfound != NULL)
Lines 834-839 Link Here
834
	if (temp1[0] != '\0') {
847
	if (temp1[0] != '\0') {
835
		(void) unlink(temp1);
848
		(void) unlink(temp1);
836
		(void) unlink(temp2);
849
		(void) unlink(temp2);
850
		if (retval = rmdir(tmpdir) != 0)
851
		{
852
			fprintf(stderr, "error deleting %s\n", tmpdir);
853
		}
837
	}
854
	}
838
	/* restore the terminal to its original mode */
855
	/* restore the terminal to its original mode */
839
	if (incurses == YES) {
856
	if (incurses == YES) {

Return to bug 71595