Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 7c4d4976e59a7f66b843e2b8bfc60b60 > files > 10

libtermcap-2.0.8-53.mga3.src.rpm

--- termcap-2.0.8/termcap.c~	Tue Apr 16 04:23:23 1996
+++ termcap-2.0.8/termcap.c	Tue Jun 30 22:39:56 1998
@@ -339,13 +339,17 @@
   struct tc_ent *l = NULL;
   int first = 1;
   int loop = 0;
+  int tc_set = 0;
 
   *tcp = NULL;
 
   /* See if we have a TERMCAP environment variable. */
   if ((tc = getenv("TERMCAP")) != NULL) {
 	if (*tc == '/')
+	{
 		tc_file = tc;
+		tc_set=1;
+	}
 	else {
 		/* check if TERMCAP is term */
 		if (tc_comp(tc, term)) {
@@ -366,8 +370,21 @@
   printf("Using file %s\n", tc_file);
 #endif
 
+  if(tc_set)
+  {
+  	setfsuid(getuid());
+  	setfsgid(getgid());
+  }
   /* Now read the termcap file. */
-  if ((fp = fopen(tc_file, "r")) == NULL) return(NULL);
+  fp = fopen(tc_file, "r");
+  
+  if(tc_set)
+  {
+  	setfsuid(geteuid());
+  	setfsgid(getegid());
+  }
+  if (fp == NULL)
+  	return(NULL);
 
   while(term) {
 	if (++loop > 16) {