slackbuilds

Personal Slackbuilds in the style of slackbuilds.org
git clone git://git.danielmoch.com/slackbuilds.git
Log | Files | Refs

el.patch (1267B)


      1 diff -ur libedit-20191231-3.1.old/src/el.c libedit-20191231-3.1/src/el.c
      2 --- libedit-20191231-3.1.old/src/el.c	2020-01-05 05:47:50.431854513 -0500
      3 +++ libedit-20191231-3.1/src/el.c	2020-01-05 06:00:35.796113913 -0500
      4 @@ -548,31 +548,17 @@
      5  
      6  	fp = NULL;
      7  	if (fname == NULL) {
      8 -#ifdef HAVE_ISSETUGID
      9 -		if (issetugid())
     10 -			return -1;
     11 -
     12 -		if ((fname = getenv("EDITRC")) == NULL) {
     13 -			static const char elpath[] = "/.editrc";
     14 -			size_t plen = sizeof(elpath);
     15 +		static const char elpath[] = "/.editrc";
     16 +		size_t plen = sizeof(elpath);
     17  
     18 -			if ((ptr = getenv("HOME")) == NULL)
     19 -				return -1;
     20 -			plen += strlen(ptr);
     21 -			if ((path = el_calloc(plen, sizeof(*path))) == NULL)
     22 -				return -1;
     23 -			(void)snprintf(path, plen, "%s%s", ptr,
     24 -				elpath + (*ptr == '\0'));
     25 -			fname = path;
     26 -		}
     27 -#else
     28 -		/*
     29 -		 * If issetugid() is missing, always return an error, in order
     30 -		 * to keep from inadvertently opening up the user to a security
     31 -		 * hole.
     32 -		 */
     33 -		return -1;
     34 -#endif
     35 +		if ((ptr = secure_getenv("HOME")) == NULL)
     36 +			return -1;
     37 +		plen += strlen(ptr);
     38 +		if ((path = el_calloc(plen, sizeof(*path))) == NULL)
     39 +			return -1;
     40 +		(void)snprintf(path, plen, "%s%s", ptr,
     41 +			elpath + (*ptr == '\0'));
     42 +		fname = path;
     43  	}
     44  	if (fname[0] == '\0')
     45  		return -1;