Update of /cvsroot/cscope/cscope/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1539/src
Modified Files:
main.c
Log Message:
Fixing sourceforge bug 1062807
Index: main.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/main.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** main.c 30 Apr 2004 15:31:43 -0000 1.33
--- main.c 6 Dec 2004 14:56:43 -0000 1.34
***************
*** 102,105 ****
--- 102,106 ----
char temp1[PATHLEN + 1]; /* temporary file name */
char temp2[PATHLEN + 1]; /* temporary file name */
+ char tempdirpv[PATHLEN +1]; /* private temp directory */
long totalterms; /* total inverted index terms */
BOOL trun_syms; /* truncate symbols to 8 characters */
***************
*** 132,135 ****
--- 133,137 ----
pid_t pid;
struct stat stat_buf;
+ mode_t orig_umask;
yyin = stdin;
***************
*** 331,337 ****
/* create the temporary file names */
pid = getpid();
! (void) sprintf(temp1, "%s/cscope%d.1", tmpdir, pid);
! (void) sprintf(temp2, "%s/cscope%d.2", tmpdir, pid);
/* if running in the foreground */
--- 333,348 ----
/* create the temporary file names */
+ orig_umask = umask(S_IRWXG|S_IRWXO);
pid = getpid();
! (void) sprintf(tempdirpv, "%s/cscope.%d", tmpdir, pid);
! if(mkdir(tempdirpv,S_IRWXU))
! {
! fprintf(stderr, "cscope: Could not create private temp dir %s\n",tempdirpv);
! myexit(1);
! }
! umask(orig_umask);
!
! (void) sprintf(temp1, "%s/cscope.1", tempdirpv, pid);
! (void) sprintf(temp2, "%s/cscope.2", tempdirpv, pid);
/* if running in the foreground */
***************
*** 835,838 ****
--- 846,850 ----
(void) unlink(temp1);
(void) unlink(temp2);
+ (void) rmdir(tempdirpv);
}
/* restore the terminal to its original mode */
|