]> granicus.if.org Git - fcron/commitdiff
strdup2 now check the return value of malloc()
authorthib <thib>
Sun, 18 Jun 2000 13:14:16 +0000 (13:14 +0000)
committerthib <thib>
Sun, 18 Jun 2000 13:14:16 +0000 (13:14 +0000)
subs.c

diff --git a/subs.c b/subs.c
index a8e7d05612c53b72f4e7db8c0f8c2f00f065fcdb..5267e0b302e34b0ba212adf6e057c973dad2168a 100644 (file)
--- a/subs.c
+++ b/subs.c
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: subs.c,v 1.3 2000-05-30 19:27:35 thib Exp $ */
+ /* $Id: subs.c,v 1.4 2000-06-18 13:14:16 thib Exp $ */
 
 #include "global.h"
 
+extern void die_e(char *fmt, ...);
 
 int
 remove_blanks(char *str)
@@ -61,8 +62,10 @@ strdup2(const char *str)
 {
     char *ptr = malloc(strlen(str) + 1);
 
-    if (ptr)
-        strcpy(ptr, str);
+    if ( ! ptr)
+       die_e("Could not calloc");
+
+    strcpy(ptr, str);
     return(ptr);
 }