summaryrefslogtreecommitdiffstats
path: root/system/csh/remove_publib_dep.diff
blob: 948fa72714f1a025831f4964cf9f238c0a7b1113 (plain)
diff -Naur csh-20230828/Makefile csh-20230828.patched/Makefile
--- csh-20230828/Makefile	2023-09-19 03:56:12.687978921 -0400
+++ csh-20230828.patched/Makefile	2023-09-19 04:21:16.198719211 -0400
@@ -8,7 +8,7 @@
 SRCS=	alloc.c char.c const.c csh.c dir.c dol.c error.c exec.c exp.c file.c \
 	func.c glob.c hist.c init.c lex.c misc.c parse.c proc.c \
 	sem.c set.c str.c time.c
-LDADD+=	-lbsd -lpub
+LDADD+=	-lbsd
 
 CLEANFILES+=error.h const.h
 
diff -Naur csh-20230828/alloc.c csh-20230828.patched/alloc.c
--- csh-20230828/alloc.c	2023-08-28 05:51:57.000000000 -0400
+++ csh-20230828.patched/alloc.c	2023-09-19 04:21:16.198719211 -0400
@@ -89,3 +89,15 @@
     }
     return (n);
 }
+
+void *
+xrealloc(void *p, size_t n)
+{
+    void *ptr;
+
+    if ((ptr = realloc(p, n)) == NULL) {
+	child++;
+	stderror(ERR_NOMEM);
+    }
+    return (ptr);
+}
diff -Naur csh-20230828/extern.h csh-20230828.patched/extern.h
--- csh-20230828/extern.h	2023-08-28 05:51:57.000000000 -0400
+++ csh-20230828.patched/extern.h	2023-09-19 04:24:42.595566353 -0400
@@ -284,6 +284,7 @@
 void	*xreallocarray(void *, size_t, size_t);
 void	*xcalloc(size_t, size_t);
 char	*xstrdup(const char *);
+void	*xrealloc(void *p, size_t n);
 
 /*
  * str.c:
diff -Naur csh-20230828/glob.c csh-20230828.patched/glob.c
--- csh-20230828/glob.c	2023-09-19 03:56:12.707979197 -0400
+++ csh-20230828.patched/glob.c	2023-09-19 04:22:08.760444266 -0400
@@ -455,7 +455,7 @@
 	 * Output is empty, or none of the magic patterns matched.
 	 * It's up to the caller to generate a "No match" error.
 	 */
-	xfree(nv);
+	if(nv) free(nv);
 	return (NULL);
     }
     *nvp = NULL;