Package Tools Utilities

Pkgtools – is a set of utilities to create, install, remove, and update packages.

73 Commits   0 Branches   12 Tags   |
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 70)
+++ src/Makefile.am	(revision 71)
@@ -1,29 +1,30 @@
 
-noinst_HEADERS = defs.h cmpvers.h dlist.h btree.h jsmin.h make-pkglist.h msglog.h pkglist.h system.h dialog-ui.h
+noinst_HEADERS = defs.h cmpvers.h dlist.h btree.h jsmin.h make-pkglist.h msglog.h wrapper.h \
+                 pkglist.h system.h dialog-ui.h
 
 sbin_PROGRAMS  = chrefs pkginfo pkglog make-package make-pkglist check-db-integrity check-package check-requires \
                  install-package remove-package update-package install-pkglist
 
 
-chrefs_SOURCES             = chrefs.c system.c msglog.c
-pkginfo_SOURCES            = pkginfo.c system.c msglog.c
-pkglog_SOURCES             = pkglog.c system.c msglog.c
+chrefs_SOURCES             = chrefs.c system.c msglog.c wrapper.c
+pkginfo_SOURCES            = pkginfo.c system.c msglog.c wrapper.c
+pkglog_SOURCES             = pkglog.c system.c msglog.c wrapper.c
 
-check_db_integrity_SOURCES = check-db-integrity.c system.c msglog.c cmpvers.c dlist.c btree.c jsmin.c pkglist.c
+check_db_integrity_SOURCES = check-db-integrity.c system.c msglog.c wrapper.c cmpvers.c dlist.c btree.c jsmin.c pkglist.c
 check_db_integrity_LDADD   = -lm
 
-check_requires_SOURCES     = check-requires.c system.c msglog.c cmpvers.c dlist.c btree.c jsmin.c pkglist.c
+check_requires_SOURCES     = check-requires.c system.c msglog.c wrapper.c cmpvers.c dlist.c btree.c jsmin.c pkglist.c
 check_requires_LDADD       = -lm
 
-check_package_SOURCES      = check-package.c system.c msglog.c cmpvers.c
+check_package_SOURCES      = check-package.c system.c msglog.c wrapper.c cmpvers.c
 
-make_pkglist_SOURCES       = make-pkglist.c system.c msglog.c cmpvers.c dlist.c btree.c jsmin.c pkglist.c
+make_pkglist_SOURCES       = make-pkglist.c system.c msglog.c wrapper.c cmpvers.c dlist.c btree.c jsmin.c pkglist.c
 make_pkglist_LDADD         = -lm
 
-make_package_SOURCES       = make-package.c system.c msglog.c dlist.c
+make_package_SOURCES       = make-package.c system.c msglog.c wrapper.c dlist.c
 make_package_LDADD         = -lm
 
-install_package_SOURCES    = install-package.c system.c msglog.c cmpvers.c dlist.c
+install_package_SOURCES    = install-package.c system.c msglog.c wrapper.c cmpvers.c dlist.c
 install_package_LDADD      = -lm
 if USE_DIALOG
   install_package_SOURCES += dialog-ui.c
@@ -32,7 +33,7 @@
   install_package_LDADD   += $(DIALOG_LIBS)
 endif
 
-remove_package_SOURCES     = remove-package.c system.c msglog.c cmpvers.c dlist.c
+remove_package_SOURCES     = remove-package.c system.c msglog.c wrapper.c cmpvers.c dlist.c
 remove_package_LDADD       = -lm
 if USE_DIALOG
   remove_package_SOURCES  += dialog-ui.c
@@ -41,7 +42,7 @@
   remove_package_LDADD    += $(DIALOG_LIBS)
 endif
 
-update_package_SOURCES     = update-package.c system.c msglog.c cmpvers.c dlist.c
+update_package_SOURCES     = update-package.c system.c msglog.c wrapper.c cmpvers.c dlist.c
 update_package_LDADD       = -lm
 if USE_DIALOG
   update_package_SOURCES  += dialog-ui.c
@@ -50,7 +51,7 @@
   update_package_LDADD    += $(DIALOG_LIBS)
 endif
 
-install_pkglist_SOURCES    = install-pkglist.c system.c msglog.c cmpvers.c dlist.c
+install_pkglist_SOURCES    = install-pkglist.c system.c msglog.c wrapper.c cmpvers.c dlist.c
 install_pkglist_LDADD      = -lm -lpthread
 if USE_DIALOG
   install_pkglist_SOURCES += dialog-ui.c
Index: src/btree.c
===================================================================
--- src/btree.c	(revision 70)
+++ src/btree.c	(revision 71)
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stddef.h>
-#include <limits.h>
+#include <linux/limits.h>
 
 #include <msglog.h>
 
Index: src/check-db-integrity.c
===================================================================
--- src/check-db-integrity.c	(revision 70)
+++ src/check-db-integrity.c	(revision 71)
@@ -26,7 +26,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -54,6 +55,7 @@
 #include <getopt.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 #include <dlist.h>
 #include <pkglist.h>
@@ -610,7 +612,7 @@
       {
         if( optarg != NULL )
         {
-          root = strdup( optarg );
+          root = xstrdup( (const char *)optarg );
           remove_trailing_slash( root );
         }
         else
@@ -622,7 +624,7 @@
       {
         if( optarg != NULL )
         {
-          errlog_fname = strdup( optarg );
+          errlog_fname = xstrdup( (const char *)optarg );
         }
         else
           /* option is present but without value */
@@ -646,13 +648,13 @@
       in the SETUP_DB_PATH. If this argument is defined then we
       ignore --root, --log options.
      */
-    pkgs_path = strdup( (const char *)argv[optind] );
+    pkgs_path = xstrdup( (const char *)argv[optind] );
     remove_trailing_slash( pkgs_path );
 
     /* output LOG into stderr*/
     if( root )         { free( root );         root         = NULL; }
     if( errlog_fname ) { free( errlog_fname ); errlog_fname = NULL; }
-    errlog_fname = strdup( "-" );
+    errlog_fname = xstrdup( "-" );
   }
 
 
@@ -670,7 +672,7 @@
     if( !root )
     {
       buf[0] = '/'; buf[1] = '\0';
-      root = strdup( (const char *)&buf[0] );
+      root = xstrdup( (const char *)&buf[0] );
     }
     else
     {
@@ -691,7 +693,7 @@
 
     if( S_ISDIR(st.st_mode) )
     {
-      pkgs_path = strdup( (const char *)&buf[0] );
+      pkgs_path = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
     else
@@ -736,7 +738,7 @@
     if( S_ISDIR(st.st_mode) )
     {
       (void)strcat( buf, LOG_FILE );
-      errlog_fname = strdup( (const char *)&buf[0] );
+      errlog_fname = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
     else
@@ -920,7 +922,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 
@@ -1430,7 +1432,7 @@
       get_short_description( buf, (const char *)line );
       if( buf[0] != '\0' )
       {
-        package->pkginfo->short_description = strdup( buf );
+        package->pkginfo->short_description = xstrdup( (const char *)buf );
       }
       free( buf );
     }
@@ -1499,9 +1501,9 @@
 
         pkg = pkg_alloc();
 
-        if( group ) pkg->group = strdup( group );
-        pkg->name    = strdup( name );
-        pkg->version = strdup( version );
+        if( group ) pkg->group = xstrdup( (const char *)group );
+        pkg->name    = xstrdup( (const char *)name );
+        pkg->version = xstrdup( (const char *)version );
 
         add_reference( package, pkg );
         ++pkgs;
@@ -1570,9 +1572,9 @@
 
           pkg = pkg_alloc();
 
-          if( group ) pkg->group = strdup( group );
-          pkg->name    = strdup( name );
-          pkg->version = strdup( version );
+          if( group ) pkg->group = xstrdup( (const char *)group );
+          pkg->name    = xstrdup( (const char *)name );
+          pkg->version = xstrdup( (const char *)version );
 
           add_required( package, pkg );
           ++pkgs;
@@ -2019,7 +2021,7 @@
       return;
     }
 
-    if( hardware ) package->hardware = strdup( hardware );
+    if( hardware ) package->hardware = xstrdup( (const char *)hardware );
     if( tarballs ) /* find tarball and allocate package->tarball */
     {
       struct pkginfo *info = package->pkginfo;
@@ -2045,7 +2047,7 @@
       tgz = find_tarball( (const char *)&buf[0] );
       if( tgz )
       {
-        package->tarball = strdup( tgz );
+        package->tarball = xstrdup( (const char *)tgz );
 
         bzero( (void *)&buf[0], PATH_MAX );
         (void)sprintf( buf, "%s/%s", pkgs_path, tgz );
@@ -2583,7 +2585,7 @@
       {
         if( refs )
         {
-          *ptr = strdup( ln ); ++ptr;
+          *ptr = xstrdup( (const char *)ln ); ++ptr;
           *ptr = (char *)0;
           ++pkgs;
         }
@@ -2830,7 +2832,7 @@
         {
           char *buf = NULL, *p = NULL, *q = NULL;
 
-          p = q = buf = strdup( (const char *)pkglog );
+          p = q = buf = xstrdup( (const char *)pkglog );
           ++p;
           while( *p != '\0' && !isblank(*p) && !(*q == '-' && isdigit(*p)) )
           {
@@ -2846,7 +2848,7 @@
           if( strlen(pname) >= strlen(buf) )
           {
 
-            pkglog_fname = strdup( (const char *)path );
+            pkglog_fname = xstrdup( (const char *)path );
             free( buf );
             closedir( dir );
             return;
@@ -3085,7 +3087,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/check-package.c
===================================================================
--- src/check-package.c	(revision 70)
+++ src/check-package.c	(revision 71)
@@ -26,7 +26,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -52,6 +53,7 @@
 #include <getopt.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 #include <cmpvers.h>
 
@@ -529,7 +531,7 @@
       {
         if( optarg != NULL )
         {
-          root = strdup( optarg );
+          root = xstrdup( (const char *)optarg );
           remove_trailing_slash( root );
         }
         else
@@ -549,7 +551,7 @@
 
   if( optind < argc )
   {
-    pkg_fname = strdup( (const char *)argv[optind] );
+    pkg_fname = xstrdup( (const char *)argv[optind] );
   }
   else
   {
@@ -591,7 +593,7 @@
 
     if( S_ISDIR(st.st_mode) )
     {
-      pkgs_path = strdup( (const char *)&buf[0] );
+      pkgs_path = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
     else
@@ -620,7 +622,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 
@@ -692,7 +694,7 @@
         {
           char *buf = NULL, *p = NULL, *q = NULL;
 
-          p = q = buf = strdup( (const char *)pkglog );
+          p = q = buf = xstrdup( (const char *)pkglog );
           ++p;
           while( *p != '\0' && !isblank(*p) && !(*q == '-' && isdigit(*p)) )
           {
@@ -708,7 +710,7 @@
           if( strlen(pkg_fname) >= strlen(buf) )
           {
 
-            pkg_found = strdup( (const char *)path );
+            pkg_found = xstrdup( (const char *)path );
             free( buf );
             closedir( dir );
             return;
@@ -1356,7 +1358,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/check-requires.c
===================================================================
--- src/check-requires.c	(revision 70)
+++ src/check-requires.c	(revision 71)
@@ -26,7 +26,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -54,6 +55,7 @@
 #include <getopt.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 #include <dlist.h>
 #include <pkglist.h>
@@ -542,7 +544,7 @@
       {
         if( optarg != NULL )
         {
-          root = strdup( optarg );
+          root = xstrdup( (const char *)optarg );
           remove_trailing_slash( root );
         }
         else
@@ -579,7 +581,7 @@
 
     if( S_ISREG(st.st_mode) )
     {
-      pkg_fname = strdup( (const char *)&buf[0] );
+      pkg_fname = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
     else
@@ -627,7 +629,7 @@
 
     if( S_ISDIR(st.st_mode) )
     {
-      pkgs_path = strdup( (const char *)&buf[0] );
+      pkgs_path = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
     else
@@ -786,7 +788,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 
@@ -1373,7 +1375,7 @@
       get_short_description( buf, (const char *)line );
       if( buf[0] != '\0' )
       {
-        package->pkginfo->short_description = strdup( buf );
+        package->pkginfo->short_description = xstrdup( (const char *)buf );
       }
       free( buf );
     }
@@ -1442,9 +1444,9 @@
 
         pkg = pkg_alloc();
 
-        if( group ) pkg->group = strdup( group );
-        pkg->name    = strdup( name );
-        pkg->version = strdup( version );
+        if( group ) pkg->group = xstrdup( (const char *)group );
+        pkg->name    = xstrdup( (const char *)name );
+        pkg->version = xstrdup( (const char *)version );
 
         add_reference( package, pkg );
         ++pkgs;
@@ -1513,9 +1515,9 @@
 
           pkg = pkg_alloc();
 
-          if( group ) pkg->group = strdup( group );
-          pkg->name    = strdup( name );
-          pkg->version = strdup( version );
+          if( group ) pkg->group = xstrdup( (const char *)group );
+          pkg->name    = xstrdup( (const char *)name );
+          pkg->version = xstrdup( (const char *)version );
 
           add_required( package, pkg );
           ++pkgs;
@@ -1958,7 +1960,7 @@
       return;
     }
 
-    if( hardware ) package->hardware = strdup( hardware );
+    if( hardware ) package->hardware = xstrdup( (const char *)hardware );
     if( tarballs ) /* find tarball and allocate package->tarball */
     {
       struct pkginfo *info = package->pkginfo;
@@ -1984,7 +1986,7 @@
       tgz = find_tarball( (const char *)&buf[0] );
       if( tgz )
       {
-        package->tarball = strdup( tgz );
+        package->tarball = xstrdup( (const char *)tgz );
 
         bzero( (void *)&buf[0], PATH_MAX );
         (void)sprintf( buf, "%s/%s", pkgs_path, tgz );
@@ -2400,7 +2402,7 @@
         {
           char *buf = NULL, *p = NULL, *q = NULL;
 
-          p = q = buf = strdup( (const char *)pkglog );
+          p = q = buf = xstrdup( (const char *)pkglog );
           ++p;
           while( *p != '\0' && !isblank(*p) && !(*q == '-' && isdigit(*p)) )
           {
@@ -2416,7 +2418,7 @@
           if( strlen(pname) >= strlen(buf) )
           {
 
-            pkglog_fname = strdup( (const char *)path );
+            pkglog_fname = xstrdup( (const char *)path );
             free( buf );
             closedir( dir );
             return;
@@ -2514,7 +2516,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/chrefs.c
===================================================================
--- src/chrefs.c	(revision 70)
+++ src/chrefs.c	(revision 71)
@@ -26,7 +26,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -50,6 +51,7 @@
 #include <getopt.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 
 #define PROGRAM_NAME "chrefs"
@@ -379,11 +381,11 @@
   pkg = (struct package *)malloc( sizeof(struct package) );
   if( pkg )
   {
-    pkg->name           = strdup( name           );
-    pkg->version        = strdup( version        );
-    pkg->arch           = strdup( arch           );
-    pkg->distro_name    = strdup( distro_name    );
-    pkg->distro_version = strdup( distro_version );
+    pkg->name           = xstrdup( (const char *)name           );
+    pkg->version        = xstrdup( (const char *)version        );
+    pkg->arch           = xstrdup( (const char *)arch           );
+    pkg->distro_name    = xstrdup( (const char *)distro_name    );
+    pkg->distro_version = xstrdup( (const char *)distro_version );
   }
 
   return pkg;
@@ -640,7 +642,7 @@
       {
         if( optarg != NULL )
         {
-          destination = strdup( optarg );
+          destination = xstrdup( (const char *)optarg );
           remove_trailing_slash( destination );
         }
         else
@@ -650,7 +652,7 @@
       }
       case 'o':
       {
-        operation = strdup( optarg );
+        operation = xstrdup( (const char *)optarg );
         to_lowercase( operation );
         if( strcmp( operation, "inc" ) != 0 && strcmp( operation, "dec" ) != 0 )
         {
@@ -684,7 +686,7 @@
 
     if( destination == NULL )
     {
-      pkglog_fname = strdup( argv[optind++] );
+      pkglog_fname = xstrdup( (const char *)argv[optind++] );
       if( pkglog_fname == NULL )
       {
         FATAL_ERROR( "Unable to set input PKGLOG file name" );
@@ -692,7 +694,7 @@
 
       bzero( (void *)buf, PATH_MAX );
       (void)sprintf( buf, "%s", pkglog_fname );
-      destination  = strdup( dirname( buf ) );
+      destination  = xstrdup( (const char *)dirname( buf ) );
       if( destination == NULL )
       {
         FATAL_ERROR( "Unable to set destination directory" );
@@ -703,7 +705,7 @@
     {
       bzero( (void *)buf, PATH_MAX );
       (void)sprintf( buf, "%s/%s", destination, argv[optind++] );
-      pkglog_fname = strdup( buf );
+      pkglog_fname = xstrdup( (const char *)buf );
       if( pkglog_fname == NULL )
       {
         FATAL_ERROR( "Unable to set inpit PKGLOG file name" );
@@ -744,7 +746,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 
@@ -1635,7 +1637,7 @@
       {
         if( refs )
         {
-          *ptr = strdup( ln ); ++ptr;
+          *ptr = xstrdup( (const char *)ln ); ++ptr;
           *ptr = (char *)0;
           ++pkgs;
         }
@@ -1839,7 +1841,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
@@ -1910,7 +1912,7 @@
     if( !buf ) { FATAL_ERROR( "Cannot allocate memory" ); }
 
     (void)sprintf( (char *)&buf[0], "%s/.REQUIRES", tmpdir );
-    requires_fname = strdup( (char *)&buf[0] );
+    requires_fname = xstrdup( (const char *)&buf[0] );
     free( buf );
   }
 
Index: src/dialog-ui.c
===================================================================
--- src/dialog-ui.c	(revision 70)
+++ src/dialog-ui.c	(revision 71)
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <limits.h>
+#include <linux/limits.h>
 #include <strings.h>  /* index(3)    */
 
 #include <dialog.h>
@@ -26,6 +26,7 @@
 #include <dlg_keys.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 
   /*************************************************
     Ruler: 68 characters + 2 spaces left and right:
Index: src/install-package.c
===================================================================
--- src/install-package.c	(revision 70)
+++ src/install-package.c	(revision 71)
@@ -27,7 +27,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -57,6 +58,7 @@
 #include <config.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 
 #include <cmpvers.h>
@@ -796,7 +798,7 @@
       {
         if( optarg != NULL )
         {
-          pkglist_fname = strdup( optarg );
+          pkglist_fname = xstrdup( (const char *)optarg );
         }
         else
           /* option is present but without value */
@@ -820,11 +822,11 @@
               (void)sprintf( cwd, "%s", curdir );
             else
               (void)sprintf( cwd, "%s/%s", curdir, optarg );
-            root = strdup( (const char *)cwd );
+            root = xstrdup( (const char *)cwd );
           }
           else
           {
-            root = strdup( optarg );
+            root = xstrdup( (const char *)optarg );
           }
           remove_trailing_slash( root );
         }
@@ -867,9 +869,9 @@
 
     if( S_ISREG(st.st_mode) )
     {
-      pkg_fname = strdup( (const char *)&buf[0] );
+      pkg_fname = xstrdup( (const char *)&buf[0] );
       bind_asc_extention( buf );
-      asc_fname = strdup( (const char *)&buf[0] );
+      asc_fname = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
     else
@@ -898,7 +900,7 @@
     if( !root )
     {
       buf[0] = '/'; buf[1] = '\0';
-      root = strdup( (const char *)buf );
+      root = xstrdup( (const char *)buf );
     }
     else
     {
@@ -908,7 +910,7 @@
       if( buf[ len - 1 ] != '/' )
       {
         buf[len] = '/'; buf[len+1] = '\0';
-        free( root ); root = strdup( (const char *)buf );
+        free( root ); root = xstrdup( (const char *)buf );
       }
     }
 
@@ -928,7 +930,7 @@
     {
       FATAL_ERROR( "Cannot access '/%s' directory", PACKAGES_PATH );
     }
-    pkgs_path = strdup( (const char *)&buf[0] );
+    pkgs_path = xstrdup( (const char *)&buf[0] );
 
     /*********************************************
       Create other directories of Setup Database:
@@ -939,7 +941,7 @@
     {
       FATAL_ERROR( "Cannot access '/%s' directory", REMOVED_PKGS_PATH );
     }
-    rempkgs_path = strdup( (const char *)&buf[0] );
+    rempkgs_path = xstrdup( (const char *)&buf[0] );
 
     buf[len] = '\0';
     (void)strcat( buf, SETUP_PATH );
@@ -954,7 +956,7 @@
     buf[len] = '\0';
     (void)strcat( buf, LOG_PATH );
     (void)strcat( buf, SETUP_LOG_FILE );
-    log_fname = strdup( (const char *)&buf[0] );
+    log_fname = xstrdup( (const char *)&buf[0] );
 
     free( buf );
 
@@ -1007,7 +1009,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 
@@ -1081,7 +1083,7 @@
     (void)sprintf( (char *)&tmp[0], "%.*gK", nd, sz );
   }
 
-  ret = strdup( (const char *)&tmp[0] );
+  ret = xstrdup( (const char *)&tmp[0] );
   free( tmp );
 
   return ret;
@@ -1151,7 +1153,7 @@
         if( b && e && ( b != e ) )
         {
           p = ++b; *e = '\0';
-          short_description = strdup( (const char *)p );
+          short_description = xstrdup( (const char *)p );
         }
       }
     }
@@ -1277,7 +1279,7 @@
       FATAL_ERROR( "Cannot get PKGLOG from '%s' file: %s", basename( (char *)fname ), strerror( errno ) );
     }
 
-    pkglog_fname = strdup( (const char *)cmd );
+    pkglog_fname = xstrdup( (const char *)cmd );
 
     /*************************************
       Attempt to read packages list file:
@@ -1300,7 +1302,7 @@
           Save default packages list file name:
          */
         (void)strcat( cmd, "/.pkglist" );
-        pkglist_fname = strdup( (const char *)cmd );
+        pkglist_fname = xstrdup( (const char *)cmd );
       }
 
       /**************************
@@ -1761,12 +1763,12 @@
     {
       *(ln + strlen(ln) - 1) = '\0';
       (void)sprintf( &tmp[0], "%s%s", (const char *)root, (const char *)ln );
-      dirs = dlist_append( dirs, strdup( (const char *)&tmp[0] ) );
+      dirs = dlist_append( dirs, xstrdup( (const char *)&tmp[0] ) );
     }
     else
     {
       (void)sprintf( &tmp[0], "%s%s", (const char *)root, (const char *)ln );
-      files = dlist_append( files, strdup( (const char *)&tmp[0] ) );
+      files = dlist_append( files, xstrdup( (const char *)&tmp[0] ) );
     }
 
   } /* End of while( file list entry ) */
@@ -1831,7 +1833,7 @@
       if( p && f )
       {
         (void)sprintf( &tmp[0], "%s%s/%s", (const char *)root, p, f );
-        links = dlist_append( links, strdup( (const char *)&tmp[0] ) );
+        links = dlist_append( links, xstrdup( (const char *)&tmp[0] ) );
       }
     }
   } /* End of while( restore links entry ) */
@@ -2067,7 +2069,7 @@
   (void)sprintf( lp, "   Compressed Size: %s\n", compressed_size );
   lp += strlen( compressed_size ) + 21;
 
-  description = strdup( (const char *)&tmp[0] );
+  description = xstrdup( (const char *)&tmp[0] );
 
   free( buf );
   free( line );
@@ -2605,7 +2607,7 @@
   {
     char *p = NULL;
     remove_trailing_slash( cwd );
-    p = strdup( cwd );
+    p = xstrdup( (const char *)cwd );
     free( cwd );
     return p;
   }
@@ -2636,7 +2638,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/install-pkglist.c
===================================================================
--- src/install-pkglist.c	(revision 70)
+++ src/install-pkglist.c	(revision 71)
@@ -27,7 +27,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -57,6 +58,7 @@
 #include <getopt.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 #include <dlist.h>
 
@@ -763,11 +765,11 @@
               (void)sprintf( cwd, "%s", curdir );
             else
               (void)sprintf( cwd, "%s/%s", curdir, optarg );
-            root = strdup( (const char *)cwd );
+            root = xstrdup( (const char *)cwd );
           }
           else
           {
-            root = strdup( optarg );
+            root = xstrdup( (const char *)optarg );
           }
           remove_trailing_slash( root );
         }
@@ -787,11 +789,11 @@
           if( optarg[0] != '/' && curdir )
           {
             (void)sprintf( cwd, "%s/%s", curdir, optarg );
-            srcdir = strdup( (const char *)cwd );
+            srcdir = xstrdup( (const char *)cwd );
           }
           else
           {
-            srcdir = strdup( optarg );
+            srcdir = xstrdup( (const char *)optarg );
           }
           remove_trailing_slash( srcdir );
         }
@@ -827,7 +829,7 @@
 
     if( srcdir)
     {
-      char *tmp = strdup( (const char *)&buf[0] );
+      char *tmp = xstrdup( (const char *)&buf[0] );
 
       /* Ignore already defined srcdir if absolute path is specified: */
       if( buf[0] != '/' )
@@ -841,11 +843,11 @@
       }
       free( tmp );
 
-      free( srcdir ); srcdir = strdup( (const char *)buf );
+      free( srcdir ); srcdir = xstrdup( (const char *)buf );
     }
     else
     {
-      char *tmp = strdup( (const char *)&buf[0] );
+      char *tmp = xstrdup( (const char *)&buf[0] );
 
       if( buf[0] != '/' && curdir )
       {
@@ -858,7 +860,7 @@
       }
       free( tmp );
 
-      srcdir = strdup( (const char *)buf );
+      srcdir = xstrdup( (const char *)buf );
     }
 
     stat( (const char *)&buf[0], &st ); /* Do not check return status */
@@ -869,14 +871,14 @@
         Add default '.pkglist' file name to the source dir name:
        */
       (void)sprintf( buf, "%s/.pkglist", srcdir );
-      pkglist_fname = strdup( (const char *)buf );
+      pkglist_fname = xstrdup( (const char *)buf );
     }
     else
     {
       if( S_ISREG(st.st_mode) )
       {
-        pkglist_fname = strdup( (const char *)buf );
-        free( srcdir ); srcdir = strdup( (const char *)dirname( (char *)&buf[0] ) );
+        pkglist_fname = xstrdup( (const char *)buf );
+        free( srcdir ); srcdir = xstrdup( (const char *)dirname( (char *)&buf[0] ) );
       }
       else
       {
@@ -908,7 +910,7 @@
     if( !root )
     {
       buf[0] = '/'; buf[1] = '\0';
-      root = strdup( (const char *)buf );
+      root = xstrdup( (const char *)buf );
     }
     else
     {
@@ -918,7 +920,7 @@
       if( buf[ len - 1 ] != '/' )
       {
         buf[len] = '/'; buf[len+1] = '\0';
-        free( root ); root = strdup( (const char *)buf );
+        free( root ); root = xstrdup( (const char *)buf );
       }
     }
 
@@ -1292,10 +1294,10 @@
         {
           struct pkg *pkg = pkg_alloc();
 
-          pkg->name    = strdup( (const char *)n );
-          pkg->version = strdup( (const char *)v );
+          pkg->name    = xstrdup( (const char *)n );
+          pkg->version = xstrdup( (const char *)v );
           if( g )
-            pkg->group = strdup( (const char *)g );
+            pkg->group = xstrdup( (const char *)g );
 
           add_required( pkg );
         }
@@ -1355,9 +1357,9 @@
 
       package = package_alloc();
 
-      package->name        = strdup( (const char *)name );
-      package->version     = strdup( (const char *)vers );
-      package->description = strdup( (const char *)desc );
+      package->name        = xstrdup( (const char *)name );
+      package->version     = xstrdup( (const char *)vers );
+      package->description = xstrdup( (const char *)desc );
 
       (void)sprintf( buf, "%s/%s", (const char *)srcdir, (const char *)ball );
       {
@@ -1370,7 +1372,7 @@
           FATAL_ERROR( "Unknown format of '%s' package file", (const char *)&buf[0] );
         }
       }
-      package->tarball     = strdup( (const char *)&buf[0] );
+      package->tarball     = xstrdup( (const char *)&buf[0] );
 
       free( buf );
 
@@ -1403,7 +1405,7 @@
       {
         *group = '\0';
         group = ball;
-        package->group = strdup( (const char *)group );
+        package->group = xstrdup( (const char *)group );
       }
 
       add_package( package );
@@ -1485,9 +1487,9 @@
       }
 
       items[i].name = name;
-      items[i].text = strdup( (const char *)package->description );
+      items[i].text = xstrdup( (const char *)package->description );
       if( package->group )
-        items[i].help = strdup( (const char *)package->group );
+        items[i].help = xstrdup( (const char *)package->group );
       items[i].state = 1;
     }
     ++i;
@@ -1670,10 +1672,10 @@
   {
     struct pkgrc *pkgrc = pkgrc_alloc();
 
-    pkgrc->name    = strdup( (const char *)package->name );
-    pkgrc->version = strdup( (const char *)package->version );
+    pkgrc->name    = xstrdup( (const char *)package->name );
+    pkgrc->version = xstrdup( (const char *)package->version );
     if( package->group )
-      pkgrc->group = strdup( (const char *)package->group );
+      pkgrc->group = xstrdup( (const char *)package->group );
     pkgrc->pid     = sys_exec_command( cmd );
 
     add_pkgrc( pkgrc );
@@ -1807,7 +1809,7 @@
   {
     char *p = NULL;
     remove_trailing_slash( cwd );
-    p = strdup( cwd );
+    p = xstrdup( (const char *)cwd );
     free( cwd );
     return p;
   }
@@ -1838,7 +1840,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/make-package.c
===================================================================
--- src/make-package.c	(revision 70)
+++ src/make-package.c	(revision 71)
@@ -26,7 +26,8 @@
 #include <dirent.h>
 #include <sys/stat.h> /* chmod(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <libgen.h>   /* basename(3) */
 #include <ctype.h>    /* tolower(3)  */
@@ -51,6 +52,7 @@
 #include <getopt.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 #include <dlist.h>
 
@@ -491,7 +493,7 @@
       {
         if( optarg != NULL )
         {
-          destination = strdup( optarg );
+          destination = xstrdup( (const char *)optarg );
           remove_trailing_slash( destination );
         }
         else
@@ -562,7 +564,7 @@
           (void)strcpy( buf, (const char *)optarg );
           to_lowercase( buf );
 
-          flavour = strdup( (const char *)&buf[0] );
+          flavour = xstrdup( (const char *)&buf[0] );
           free( buf );
         }
         else
@@ -613,7 +615,7 @@
           }
 
           remove_trailing_slash( buf );
-          gnupghome = strdup( (const char *)&buf[0] );
+          gnupghome = xstrdup( (const char *)&buf[0] );
           free( buf );
         }
         else
@@ -661,7 +663,7 @@
             FATAL_ERROR( "The passphrase '%s' is not a regular file", basename( buf ) );
           }
 
-          passphrase = strdup( (const char *)&buf[0] );
+          passphrase = xstrdup( (const char *)&buf[0] );
           free( buf );
         }
         else
@@ -673,7 +675,7 @@
       {
         if( optarg != NULL )
         {
-          key_id = strdup( optarg );
+          key_id = xstrdup( (const char *)optarg );
         }
         else
           /* option is present but without value */
@@ -737,7 +739,7 @@
     *(strstr( buf, "/.INSTALL" )) = '\0'; /* restore tmpdir in tmp[] buffer */
 
 
-    srcdir = strdup( (const char *)&buf[0] );
+    srcdir = xstrdup( (const char *)&buf[0] );
     if( srcdir == NULL )
     {
       usage();
@@ -761,7 +763,7 @@
     (void)strcpy( buf, (const char *)srcdir );
     remove_trailing_slash( (char *)&buf[0] );
 
-    destination = strdup( (const char *)dirname( (char *)&buf[0] ) );
+    destination = xstrdup( (const char *)dirname( (char *)&buf[0] ) );
 
     free( buf );
   }
@@ -785,7 +787,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 /*
@@ -885,7 +887,7 @@
           if( b && e && ( b != e ) )
           {
             p = ++b; *e = '\0';
-            short_description = strdup( (const char *)p );
+            short_description = xstrdup( (const char *)p );
           }
         }
       }
@@ -906,8 +908,8 @@
       FATAL_ERROR( "Invalid input .PKGINFO file" );
     }
 
-    if( !url )     { url     = strdup( DISTRO_URL );     }
-    if( !license ) { license = strdup( DISTRO_LICENSE ); }
+    if( !url )     { url     = xstrdup( DISTRO_URL );     }
+    if( !license ) { license = xstrdup( DISTRO_LICENSE ); }
   }
 
   fclose( pkginfo );
@@ -939,7 +941,7 @@
     }
 
     free( destination );
-    destination = strdup( (const char *)&buf[0] );
+    destination = xstrdup( (const char *)&buf[0] );
     free( buf );
   }
 
@@ -1054,7 +1056,7 @@
 static void _push_file( const char *name )
 {
   char *fname = (char *)name + strlen( srcdir ) + 1;
-  filelist = dlist_append( filelist, (void *)strdup( fname ) );
+  filelist = dlist_append( filelist, (void *)xstrdup( (const char *)fname ) );
 }
 
 static void _push_dir( const char *name )
@@ -1066,7 +1068,7 @@
   if( !buf ) { FATAL_ERROR( "Cannot allocate memory" ); }
   (void)sprintf( &buf[0], "%s/", dname );
 
-  filelist = dlist_append( filelist, (void *)strdup( (const char *)&buf[0] ) );
+  filelist = dlist_append( filelist, (void *)xstrdup( (const char *)&buf[0] ) );
   free( buf );
 }
 
@@ -1211,7 +1213,7 @@
       save total number of files:
      */
     (void)sprintf( (char *)&tmp[0], "%d", nfiles );
-    total_files = strdup( (const char *)&tmp[0] );
+    total_files = xstrdup( (const char *)&tmp[0] );
 
     /*********************************
       save uncompressed package size:
@@ -1250,7 +1252,7 @@
         (void)sprintf( (char *)&tmp[0], "%.*gK", nd, sz );
       }
     }
-    uncompressed_size = strdup( (const char *)&tmp[0] );
+    uncompressed_size = xstrdup( (const char *)&tmp[0] );
 
     free( tmp );
 
@@ -1331,7 +1333,7 @@
   get_short_description( buf, (const char *)line );
   if( buf[0] != '\0' )
   {
-    ret = strdup( buf );
+    ret = xstrdup( (const char *)buf );
   }
   free( buf );
 
@@ -1774,7 +1776,7 @@
       (void)sprintf( tmp, "%s", home );
       if( (stat( (const char *)&tmp[0], &st ) == 0) && S_ISDIR(st.st_mode) )
       {
-        gnupghome = strdup( (const char *)&tmp[0] );
+        gnupghome = xstrdup( (const char *)&tmp[0] );
       }
     }
     else
@@ -1785,7 +1787,7 @@
         (void)sprintf( tmp, "%s/.gnupg", home );
         if( (stat( (const char *)&tmp[0], &st ) == 0) && S_ISDIR(st.st_mode) )
         {
-          gnupghome = strdup( (const char *)&tmp[0] );
+          gnupghome = xstrdup( (const char *)&tmp[0] );
         }
       }
     }
@@ -1903,7 +1905,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/make-pkglist.c
===================================================================
--- src/make-pkglist.c	(revision 70)
+++ src/make-pkglist.c	(revision 71)
@@ -26,7 +26,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -55,6 +56,7 @@
 
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 
 #include <dlist.h>
@@ -125,7 +127,7 @@
   fname = (struct srcpkg_fname *)malloc( sizeof( struct srcpkg_fname ) );
   if( !fname ) { FATAL_ERROR( "Cannot allocate memory" ); }
 
-  fname->name = strdup( name );
+  fname->name = xstrdup( name );
   fname->line = line;
 
   return fname;
@@ -669,7 +671,7 @@
       {
         if( optarg != NULL )
         {
-          srcdir = strdup( optarg );
+          srcdir = xstrdup( (const char *)optarg );
           remove_trailing_slash( srcdir );
         }
         else
@@ -681,7 +683,7 @@
       {
         if( optarg != NULL )
         {
-          srclist_fname = strdup( optarg );
+          srclist_fname = xstrdup( (const char *)optarg );
           remove_trailing_slash( srclist_fname );
         }
         else
@@ -762,7 +764,7 @@
         strcpy( (char *)hw, (const char *)optarg );
         to_lowercase( hw );
 
-        hardware = strdup( (const char *)hw );
+        hardware = xstrdup( (const char *)hw );
         break;
       }
       case 'H':
@@ -772,7 +774,7 @@
         strcpy( (char *)root, (const char *)optarg );
         to_lowercase( root );
 
-        htmlroot = strdup( (const char *)root );
+        htmlroot = xstrdup( (const char *)root );
         break;
       }
 
@@ -789,8 +791,8 @@
   if( optind < argc )
   {
     struct stat st;
-    char  *buf = NULL;
-    int    hrl = 0;
+    char   *buf = NULL;
+    size_t  hrl = 0;
 
     bzero( (void *)&st, sizeof( struct stat ) );
 
@@ -811,7 +813,7 @@
     {
       if( ! srcdir )
       {
-        srcdir = strdup( (const char *)&buf[0] );
+        srcdir = xstrdup( (const char *)&buf[0] );
       }
       /* Add .pkglist or .json to the output dir name: */
       if( htmlroot )
@@ -834,7 +836,7 @@
     }
 
     if( !hardware )
-      hardware = strdup( "unknown" );
+      hardware = xstrdup( "unknown" );
 
     /* Check output directory; set srcdir and htmlroot if needed */
     {
@@ -862,10 +864,10 @@
         FATAL_ERROR( "Cannot access output '%s' directory: %s", d, strerror( errno ) );
       }
 
-      pkglist_fname = strdup( (const char *)fname );
+      pkglist_fname = xstrdup( (const char *)fname );
       if( pkglist_fname == NULL ) { usage(); }
 
-      if( !srcdir ) { srcdir = strdup( (const char *)d ); }
+      if( !srcdir ) { srcdir = xstrdup( (const char *)d ); }
 
       if( !htmlroot )
       {
@@ -874,16 +876,16 @@
         {
           *p = '\0';
           to_lowercase( f );
-          htmlroot = strdup( (const char *)f );
+          htmlroot = xstrdup( (const char *)f );
         }
         else if( *f != '.' )
         {
           to_lowercase( f );
-          htmlroot = strdup( (const char *)f );
+          htmlroot = xstrdup( (const char *)f );
         }
         else
         {
-          htmlroot = strdup( (const char *)hardware );
+          htmlroot = xstrdup( (const char *)hardware );
         }
       }
     }
@@ -902,7 +904,7 @@
  */
 static void add_exclude( const char *name )
 {
-  exclude = dlist_append( exclude, (void *)strdup( name ) );
+  exclude = dlist_append( exclude, (void *)xstrdup( name ) );
 }
 
 static void __free_exclude( void *data, void *user_data )
@@ -1250,7 +1252,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( (const char *)p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 /*******************************
@@ -1838,7 +1840,7 @@
       get_short_description( buf, (const char *)line );
       if( buf[0] != '\0' )
       {
-        package->pkginfo->short_description = strdup( (const char *)buf );
+        package->pkginfo->short_description = xstrdup( (const char *)buf );
       }
       free( buf );
     }
@@ -1907,9 +1909,9 @@
 
         pkg = pkg_alloc();
 
-        if( group ) pkg->group = strdup( (const char *)group );
-        pkg->name    = strdup( (const char *)name );
-        pkg->version = strdup( (const char *)version );
+        if( group ) pkg->group = xstrdup( (const char *)group );
+        pkg->name    = xstrdup( (const char *)name );
+        pkg->version = xstrdup( (const char *)version );
 
         add_reference( package, pkg );
         ++pkgs;
@@ -1978,9 +1980,9 @@
 
           pkg = pkg_alloc();
 
-          if( group ) pkg->group = strdup( (const char *)group );
-          pkg->name    = strdup( (const char *)name );
-          pkg->version = strdup( (const char *)version );
+          if( group ) pkg->group = xstrdup( (const char *)group );
+          pkg->name    = xstrdup( (const char *)name );
+          pkg->version = xstrdup( (const char *)version );
 
           add_required( package, pkg );
           ++pkgs;
@@ -2413,7 +2415,7 @@
       return;
     }
 
-    if( hardware ) package->hardware = strdup( (const char *)hardware );
+    if( hardware ) package->hardware = xstrdup( (const char *)hardware );
     if( tarballs ) /* find tarball and allocate package->tarball */
     {
       struct pkginfo *info = package->pkginfo;
@@ -2439,7 +2441,7 @@
       tgz = find_tarball( (const char *)&buf[0] );
       if( tgz )
       {
-        package->tarball = strdup( (const char *)tgz );
+        package->tarball = xstrdup( (const char *)tgz );
 
         bzero( (void *)&buf[0], PATH_MAX );
         (void)sprintf( buf, "%s/%s", srcdir, tgz );
@@ -3036,7 +3038,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( (const char *)dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/pkginfo.c
===================================================================
--- src/pkginfo.c	(revision 70)
+++ src/pkginfo.c	(revision 71)
@@ -25,7 +25,8 @@
 #include <dirent.h>
 #include <sys/stat.h> /* chmod(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -50,6 +51,7 @@
 
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 
 #define PROGRAM_NAME "pkginfo"
@@ -347,7 +349,7 @@
       {
         if( optarg != NULL )
         {
-          destination = strdup( optarg );
+          destination = xstrdup( (const char *)optarg );
           remove_trailing_slash( destination );
         }
         else
@@ -357,7 +359,7 @@
       }
       case 'o':
       {
-        operation = strdup( optarg );
+        operation = xstrdup( (const char *)optarg );
         to_lowercase( operation );
         break;
       }
@@ -374,9 +376,9 @@
   {
     char cwd[PATH_MAX];
     if( getcwd( cwd, sizeof(cwd) ) != NULL )
-      destination = strdup( cwd );
+      destination = xstrdup( (const char *)cwd );
     else
-      destination = strdup( "." );
+      destination = xstrdup( "." );
   }
 
   if( operation == NULL ) usage();
@@ -384,7 +386,7 @@
   /* last command line argument is the LOGFILE */
   if( optind < argc )
   {
-    pkglog_fname = strdup( argv[optind++] );
+    pkglog_fname = xstrdup( (const char *)argv[optind++] );
     if( pkglog_fname == NULL )
     {
       usage();
@@ -420,7 +422,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 /*
@@ -612,7 +614,7 @@
         get_short_description( buf, (const char *)line );
         if( buf[0] != '\0' )
         {
-          desc = strdup( buf );
+          desc = xstrdup( (const char *)buf );
         }
         free( buf );
       }
@@ -1286,7 +1288,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/pkglist.c
===================================================================
--- src/pkglist.c	(revision 70)
+++ src/pkglist.c	(revision 71)
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <limits.h>
+#include <linux/limits.h>
 #include <libgen.h>   /* basename(3) */
 #include <unistd.h>
 #include <time.h>
@@ -28,6 +28,7 @@
 #include <math.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 
 #include <make-pkglist.h>
 
@@ -74,7 +75,7 @@
  */
 void add_tarball( char *tarball )
 {
-  tarballs = dlist_append( tarballs, (void *)strdup( tarball ) );
+  tarballs = dlist_append( tarballs, (void *)xstrdup( (const char *)tarball ) );
 }
 
 static void __free_tarball( void *data, void *user_data )
@@ -447,7 +448,7 @@
 {
   if( package && package->files && fname )
   {
-    package->files->list = dlist_append( package->files->list, (void *)strdup( fname ) );
+    package->files->list = dlist_append( package->files->list, (void *)xstrdup( (const char *)fname ) );
     package->files->size = dlist_length( package->files->list );
   }
 }
@@ -597,7 +598,8 @@
       {
         char *s = ((struct pkg *)found->data)->version;
         ((struct pkg *)found->data)->version =
-           strdup( max_version( (const char *)((struct pkg *)found->data)->version, (const char *)pkg->version ) );
+           xstrdup( (const char *)max_version( (const char *)((struct pkg *)found->data)->version,
+                                               (const char *)pkg->version ) );
         free( s );
       }
     }
@@ -608,10 +610,10 @@
       {
         if( pkg->group )
         {
-          req->group = strdup( pkg->group   );
+          req->group = xstrdup( (const char *)pkg->group   );
         }
-        req->name    = strdup( pkg->name    );
-        req->version = strdup( pkg->version );
+        req->name    = xstrdup( (const char *)pkg->name    );
+        req->version = xstrdup( (const char *)pkg->version );
 
         extern_requires = dlist_append( extern_requires, (void *)req );
       }
@@ -631,10 +633,10 @@
     {
       if( package->pkginfo->group )
       {
-        provide->group = strdup( package->pkginfo->group   );
+        provide->group = xstrdup( (const char *)package->pkginfo->group   );
       }
-      provide->name    = strdup( package->pkginfo->name    );
-      provide->version = strdup( package->pkginfo->version );
+      provide->name    = xstrdup( (const char *)package->pkginfo->name    );
+      provide->version = xstrdup( (const char *)package->pkginfo->version );
 
       provides = dlist_append( provides, (void *)provide );
     }
@@ -1092,21 +1094,21 @@
   {
     if( e != f )
     {
-      (void)sprintf( e, ".pkgs.json" ); pkgs_fname = strdup( (const char *)&buf[0] );
-      (void)sprintf( e, ".tree.json" ); tree_fname = strdup( (const char *)&buf[0] );
-      (void)sprintf( e, ".tree.html" ); html_fname = strdup( (const char *)&buf[0] );
+      (void)sprintf( e, ".pkgs.json" ); pkgs_fname = xstrdup( (const char *)&buf[0] );
+      (void)sprintf( e, ".tree.json" ); tree_fname = xstrdup( (const char *)&buf[0] );
+      (void)sprintf( e, ".tree.html" ); html_fname = xstrdup( (const char *)&buf[0] );
 
-      (void)sprintf( e, ".pkgs.min.json" ); pkgs_min_fname = strdup( (const char *)&buf[0] );
-      (void)sprintf( e, ".tree.min.json" ); tree_min_fname = strdup( (const char *)&buf[0] );
+      (void)sprintf( e, ".pkgs.min.json" ); pkgs_min_fname = xstrdup( (const char *)&buf[0] );
+      (void)sprintf( e, ".tree.min.json" ); tree_min_fname = xstrdup( (const char *)&buf[0] );
     }
     else
     {
-      (void)sprintf( e, "pkgs.json" ); pkgs_fname = strdup( (const char *)&buf[0] );
-      (void)sprintf( e, "tree.json" ); tree_fname = strdup( (const char *)&buf[0] );
-      (void)sprintf( e, "tree.html" ); html_fname = strdup( (const char *)&buf[0] );
+      (void)sprintf( e, "pkgs.json" ); pkgs_fname = xstrdup( (const char *)&buf[0] );
+      (void)sprintf( e, "tree.json" ); tree_fname = xstrdup( (const char *)&buf[0] );
+      (void)sprintf( e, "tree.html" ); html_fname = xstrdup( (const char *)&buf[0] );
 
-      (void)sprintf( e, "pkgs.min.json" ); pkgs_min_fname = strdup( (const char *)&buf[0] );
-      (void)sprintf( e, "tree.min.json" ); tree_min_fname = strdup( (const char *)&buf[0] );
+      (void)sprintf( e, "pkgs.min.json" ); pkgs_min_fname = xstrdup( (const char *)&buf[0] );
+      (void)sprintf( e, "tree.min.json" ); tree_min_fname = xstrdup( (const char *)&buf[0] );
     }
   }
   else
@@ -1113,23 +1115,23 @@
   {
     e = f + strlen( f );
 
-    (void)sprintf( e, ".pkgs.json" ); pkgs_fname = strdup( (const char *)&buf[0] );
-    (void)sprintf( e, ".tree.json" ); tree_fname = strdup( (const char *)&buf[0] );
-    (void)sprintf( e, ".tree.html" ); html_fname = strdup( (const char *)&buf[0] );
+    (void)sprintf( e, ".pkgs.json" ); pkgs_fname = xstrdup( (const char *)&buf[0] );
+    (void)sprintf( e, ".tree.json" ); tree_fname = xstrdup( (const char *)&buf[0] );
+    (void)sprintf( e, ".tree.html" ); html_fname = xstrdup( (const char *)&buf[0] );
 
-    (void)sprintf( e, ".pkgs.min.json" ); pkgs_min_fname = strdup( (const char *)&buf[0] );
-    (void)sprintf( e, ".tree.min.json" ); tree_min_fname = strdup( (const char *)&buf[0] );
+    (void)sprintf( e, ".pkgs.min.json" ); pkgs_min_fname = xstrdup( (const char *)&buf[0] );
+    (void)sprintf( e, ".tree.min.json" ); tree_min_fname = xstrdup( (const char *)&buf[0] );
   }
 
   if( minimize )
   {
-    json_pkgs_file = strdup( (const char *)basename( pkgs_min_fname ) );
-    json_tree_file = strdup( (const char *)basename( tree_min_fname ) );
+    json_pkgs_file = xstrdup( (const char *)basename( pkgs_min_fname ) );
+    json_tree_file = xstrdup( (const char *)basename( tree_min_fname ) );
   }
   else
   {
-    json_pkgs_file = strdup( (const char *)basename( pkgs_fname ) );
-    json_tree_file = strdup( (const char *)basename( tree_fname ) );
+    json_pkgs_file = xstrdup( (const char *)basename( pkgs_fname ) );
+    json_tree_file = xstrdup( (const char *)basename( tree_fname ) );
   }
 
   free( buf );
@@ -1432,9 +1434,9 @@
   if( !package ) return pkg;
 
   pkg = pkg_alloc();
-  pkg->name      = strdup( package->pkginfo->name );
-  pkg->group     = strdup( package->pkginfo->group );
-  pkg->version   = strdup( package->pkginfo->version );
+  pkg->name      = xstrdup( (const char *)package->pkginfo->name );
+  pkg->group     = xstrdup( (const char *)package->pkginfo->group );
+  pkg->version   = xstrdup( (const char *)package->pkginfo->version );
   pkg->procedure = package->procedure;
 
   return pkg;
@@ -1751,9 +1753,9 @@
       bzero( (void *)buf, PATH_MAX );
 
       (void)sprintf( &buf[0], "%s", htmlroot );
-      root = strdup( (const char *)&buf[0] );
+      root = xstrdup( (const char *)&buf[0] );
       (void)sprintf( &buf[0], "%s", package->pkginfo->url );
-      bug_url = strdup( (const char *)&buf[0] );
+      bug_url = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
     else
@@ -1770,9 +1772,9 @@
         (void)sprintf( &buf[0], "%s-%s", package->pkginfo->name,
                                          package->pkginfo->version );
 
-      root = strdup( (const char *)&buf[0] );
+      root = xstrdup( (const char *)&buf[0] );
       (void)sprintf( &buf[0], "%s", package->pkginfo->url );
-      bug_url = strdup( (const char *)&buf[0] );
+      bug_url = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
 
@@ -1978,9 +1980,9 @@
       bzero( (void *)buf, PATH_MAX );
 
       (void)sprintf( &buf[0], "%s", htmlroot );
-      root = strdup( (const char *)&buf[0] );
+      root = xstrdup( (const char *)&buf[0] );
       (void)sprintf( &buf[0], "%s", package->pkginfo->url );
-      bug_url = strdup( (const char *)&buf[0] );
+      bug_url = xstrdup( (const char *)&buf[0] );
       free( buf );
 
       fprintf( ctx->output, " \"distro\": [ \"%s\", \"%s\", \"%s\" ],\n",
@@ -2018,9 +2020,9 @@
       (void)sprintf( &buf[0], "%s-%s", package->pkginfo->name,
                                        package->pkginfo->version );
 
-    root = strdup( (const char *)&buf[0] );
+    root = xstrdup( (const char *)&buf[0] );
     (void)sprintf( &buf[0], "%s", package->pkginfo->url );
-    bug_url = strdup( (const char *)&buf[0] );
+    bug_url = xstrdup( (const char *)&buf[0] );
     free( buf );
 
     fprintf( ctx->output, " \"distro\": [ \"%s\", \"%s\", \"%s\" ],\n",
Index: src/pkglog.c
===================================================================
--- src/pkglog.c	(revision 70)
+++ src/pkglog.c	(revision 71)
@@ -25,7 +25,8 @@
 #include <dirent.h>
 #include <sys/stat.h> /* chmod(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <libgen.h>   /* basename(3) */
 #include <ctype.h>    /* tolower(3)  */
@@ -48,6 +49,7 @@
 #include <getopt.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 
 #define PROGRAM_NAME "pkglog"
@@ -526,7 +528,7 @@
       {
         if( optarg != NULL )
         {
-          destination = strdup( optarg );
+          destination = xstrdup( (const char *)optarg );
           remove_trailing_slash( destination );
         }
         else
@@ -552,9 +554,9 @@
   {
     char cwd[PATH_MAX];
     if( getcwd( cwd, sizeof(cwd) ) != NULL )
-      destination = strdup( cwd );
+      destination = xstrdup( (const char *)cwd );
     else
-      destination = strdup( "." );
+      destination = xstrdup( "." );
   }
 
   /* last command line argument is the PKGLOG file */
@@ -583,7 +585,7 @@
       (void)strcat( buf, "/.PKGINFO" );
     }
 
-    pkginfo_fname = strdup( (const char *)&buf[0] );
+    pkginfo_fname = xstrdup( (const char *)&buf[0] );
     if( pkginfo_fname == NULL )
     {
       usage();
@@ -622,7 +624,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 /*
@@ -754,7 +756,7 @@
         FATAL_ERROR( "Cannot create output file" );
       }
     }
-    output_fname = strdup( (const char *)&buf[0] );
+    output_fname = xstrdup( (const char *)&buf[0] );
     if( output_fname )
     {
       output = fopen( (const char *)output_fname, "w" );
@@ -1148,7 +1150,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
@@ -1274,7 +1276,7 @@
 
       free( pkginfo_fname ); pkginfo_fname = NULL;
 
-      pkginfo_fname = strdup( buf );
+      pkginfo_fname = xstrdup( (const char *)buf );
       free( buf );
       pkginfo_type  = PKGINFO_TEXT;
     }
@@ -1293,7 +1295,7 @@
     /* function dirname() spoils the source contents: */
     (void)sprintf( buf, "%s", pkginfo_fname );
 
-    srcdir = strdup( dirname( (char *)&buf[0] ) );
+    srcdir = xstrdup( (const char *)dirname( (char *)&buf[0] ) );
     free( buf );
     rm_srcdir_at_exit = 0;
   }
Index: src/remove-package.c
===================================================================
--- src/remove-package.c	(revision 70)
+++ src/remove-package.c	(revision 71)
@@ -26,7 +26,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -615,7 +616,7 @@
           }
           else
           {
-            root = strdup( optarg );
+            root = strdup( (const char *)optarg );
           }
           remove_trailing_slash( root );
         }
Index: src/update-package.c
===================================================================
--- src/update-package.c	(revision 70)
+++ src/update-package.c	(revision 71)
@@ -27,7 +27,8 @@
 #include <sys/stat.h> /* chmod(2)    */
 #include <sys/file.h> /* flock(2)    */
 #include <fcntl.h>
-#include <limits.h>
+#include <linux/limits.h>
+#include <alloca.h>   /* alloca(3)   */
 #include <string.h>   /* strdup(3)   */
 #include <strings.h>  /* index(3)    */
 #include <libgen.h>   /* basename(3) */
@@ -57,6 +58,7 @@
 #include <config.h>
 
 #include <msglog.h>
+#include <wrapper.h>
 #include <system.h>
 
 #include <cmpvers.h>
@@ -820,7 +822,7 @@
       {
         if( optarg != NULL )
         {
-          pkglist_fname = strdup( optarg );
+          pkglist_fname = xstrdup( (const char *)optarg );
         }
         else
           /* option is present but without value */
@@ -844,11 +846,11 @@
               (void)sprintf( cwd, "%s", curdir );
             else
               (void)sprintf( cwd, "%s/%s", curdir, optarg );
-            root = strdup( (const char *)cwd );
+            root = xstrdup( (const char *)cwd );
           }
           else
           {
-            root = strdup( optarg );
+            root = xstrdup( (const char *)optarg );
           }
           remove_trailing_slash( root );
         }
@@ -891,9 +893,9 @@
 
     if( S_ISREG(st.st_mode) )
     {
-      pkg_fname = strdup( (const char *)&buf[0] );
+      pkg_fname = xstrdup( (const char *)&buf[0] );
       bind_asc_extention( buf );
-      asc_fname = strdup( (const char *)&buf[0] );
+      asc_fname = xstrdup( (const char *)&buf[0] );
       free( buf );
     }
     else
@@ -922,7 +924,7 @@
     if( !root )
     {
       buf[0] = '/'; buf[1] = '\0';
-      root = strdup( (const char *)buf );
+      root = xstrdup( (const char *)buf );
     }
     else
     {
@@ -932,7 +934,7 @@
       if( buf[ len - 1 ] != '/' )
       {
         buf[len] = '/'; buf[len+1] = '\0';
-        free( root ); root = strdup( (const char *)buf );
+        free( root ); root = xstrdup( (const char *)buf );
       }
     }
 
@@ -952,7 +954,7 @@
     {
       FATAL_ERROR( "Cannot access '/%s' directory", PACKAGES_PATH );
     }
-    pkgs_path = strdup( (const char *)&buf[0] );
+    pkgs_path = xstrdup( (const char *)&buf[0] );
 
     /*********************************************
       Create other directories of Setup Database:
@@ -963,7 +965,7 @@
     {
       FATAL_ERROR( "Cannot access '/%s' directory", REMOVED_PKGS_PATH );
     }
-    rempkgs_path = strdup( (const char *)&buf[0] );
+    rempkgs_path = xstrdup( (const char *)&buf[0] );
 
     buf[len] = '\0';
     (void)strcat( buf, SETUP_PATH );
@@ -978,7 +980,7 @@
     buf[len] = '\0';
     (void)strcat( buf, LOG_PATH );
     (void)strcat( buf, SETUP_LOG_FILE );
-    log_fname = strdup( (const char *)&buf[0] );
+    log_fname = xstrdup( (const char *)&buf[0] );
 
     free( buf );
 
@@ -1031,7 +1033,7 @@
 
   if( *p == '\0' ) return (char *)0;
 
-  return( strdup( p ) );
+  return( xstrdup( (const char *)p ) );
 }
 
 
@@ -1105,7 +1107,7 @@
     (void)sprintf( (char *)&tmp[0], "%.*gK", nd, sz );
   }
 
-  ret = strdup( (const char *)&tmp[0] );
+  ret = xstrdup( (const char *)&tmp[0] );
   free( tmp );
 
   return ret;
@@ -1200,7 +1202,7 @@
         {
           p = ++b; *e = '\0';
           if( short_description ) { free( short_description ); }
-          short_description = strdup( (const char *)p );
+          short_description = xstrdup( (const char *)p );
         }
       }
     }
@@ -1310,7 +1312,7 @@
            */
           if( *(name + strlen( pkgname )) == '-' && isdigit( *(name + strlen( pkgname ) + 1) ) )
           {
-            remlog_fname = strdup( (const char *)path );
+            remlog_fname = xstrdup( (const char *)path );
             closedir( dir );
             return;
           }
@@ -1437,8 +1439,8 @@
     (void)unlink( (const char *)&tmp[0] ); /* :remove unnecessary .PKGINFO file */
     *(strstr( tmp, "/.PKGINFO" )) = '\0';  /* :restore 'tmpdir' in tmp[] buffer */
 
-    requested_version = strdup( (const char *)pkgver );
-    requested_group   = ( group ) ? strdup( (const char *)group ) : NULL;
+    requested_version = xstrdup( (const char *)pkgver );
+    requested_group   = ( group ) ? xstrdup( (const char *)group ) : NULL;
 
     fname = NULL;
     fname = find_package();
@@ -1504,7 +1506,7 @@
     {
       FATAL_ERROR( "Cannot get PKGINFO from '%s' file", basename( (char *)fname ) );
     }
-    rtmpdir = strdup( (const char *)&tmp[0] );
+    rtmpdir = xstrdup( (const char *)&tmp[0] );
 
     cmd = (char *)malloc( (size_t)PATH_MAX );
     if( !cmd ) { FATAL_ERROR( "Cannot allocate memory" ); }
@@ -1528,8 +1530,8 @@
     read_pkginfo( (const char *)&tmp[0] );
     *(strstr( tmp, "/.PKGINFO" )) = '\0'; /* :restore tmpdir in tmp[] buffer */
 
-    installed_version = strdup( (const char *)pkgver );
-    installed_group   = ( group ) ? strdup( (const char *)group ) : NULL;
+    installed_version = xstrdup( (const char *)pkgver );
+    installed_group   = ( group ) ? xstrdup( (const char *)group ) : NULL;
 
     free( cmd );
     free( tmp );
@@ -1818,7 +1820,7 @@
       FATAL_ERROR( "Cannot get PKGLOG from '%s' file: %s", basename( (char *)fname ), strerror( errno ) );
     }
 
-    pkglog_fname = strdup( (const char *)cmd );
+    pkglog_fname = xstrdup( (const char *)cmd );
 
     /*************************************
       Attempt to read packages list file:
@@ -1841,7 +1843,7 @@
           Save default packages list file name:
          */
         (void)strcat( cmd, "/.pkglist" );
-        pkglist_fname = strdup( (const char *)cmd );
+        pkglist_fname = xstrdup( (const char *)cmd );
       }
 
       /**************************
@@ -2176,12 +2178,12 @@
     {
       *(ln + strlen(ln) - 1) = '\0';
       (void)sprintf( &tmp[0], "%s%s", (const char *)root, (const char *)ln );
-      dirs = dlist_append( dirs, strdup( (const char *)&tmp[0] ) );
+      dirs = dlist_append( dirs, xstrdup( (const char *)&tmp[0] ) );
     }
     else
     {
       (void)sprintf( &tmp[0], "%s%s", (const char *)root, (const char *)ln );
-      files = dlist_append( files, strdup( (const char *)&tmp[0] ) );
+      files = dlist_append( files, xstrdup( (const char *)&tmp[0] ) );
     }
 
   } /* End of while( file list entry ) */
@@ -2250,7 +2252,7 @@
       if( p && f )
       {
         (void)sprintf( &tmp[0], "%s%s/%s", (const char *)root, p, f );
-        links = dlist_append( links, strdup( (const char *)&tmp[0] ) );
+        links = dlist_append( links, xstrdup( (const char *)&tmp[0] ) );
       }
     }
   } /* End of while( restore links entry ) */
@@ -2644,7 +2646,7 @@
   }
 
   if( description ) { free( description ); description = NULL; }
-  description = strdup( (const char *)&tmp[0] );
+  description = xstrdup( (const char *)&tmp[0] );
 
   free( buf );
   free( line );
@@ -3237,7 +3239,7 @@
   {
     char *p = NULL;
     remove_trailing_slash( cwd );
-    p = strdup( cwd );
+    p = xstrdup( (const char *)cwd );
     free( cwd );
     return p;
   }
@@ -3268,7 +3270,7 @@
   len = readlink( "/proc/self/exe", buf, (size_t)PATH_MAX );
   if( len > 0 && len < PATH_MAX )
   {
-    char *p = strdup( dirname( buf ) );
+    char *p = xstrdup( (const char *)dirname( buf ) );
     free( buf );
     return p;
   }
Index: src/wrapper.c
===================================================================
--- src/wrapper.c	(nonexistent)
+++ src/wrapper.c	(revision 71)
@@ -0,0 +1,75 @@
+
+/**********************************************************************
+
+  Copyright 2019 Andrey V.Kosteltsev
+
+  Licensed under the Radix.pro License, Version 1.0 (the "License");
+  you may not use this file  except  in compliance with the License.
+  You may obtain a copy of the License at
+
+     https://radix.pro/licenses/LICENSE-1.0-en_US.txt
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  implied.
+
+ **********************************************************************/
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <error.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <stdarg.h>
+#include <unistd.h>
+
+#include <msglog.h>
+
+
+char *xstrdup( const char *str )
+{
+  char   *ret = (char *)NULL;
+  size_t  len;
+
+  if( !str ) return ret;
+
+  len = strlen( str ) + 1;
+
+  ret = (char *)malloc( len );
+  if( !ret )
+    FATAL_ERROR( "Out of memory, strdup failed (tried to allocate %lu bytes)", (unsigned long)len );
+
+  ret[len-1] = '\0';
+  ret = strncpy( ret, str, len-1 );
+  return ret;
+}
+
+void *xmalloc( size_t size )
+{
+  void *ret = NULL;
+
+  ret = malloc( size );
+  if( !ret )
+  {
+    FATAL_ERROR( "Out of memory, malloc failed (tried to allocate %lu bytes)", (unsigned long)size );
+  }
+  memset( ret, 0, size );
+  return ret;
+}
+
+void *xrealloc( void *ptr, size_t size )
+{
+  void *ret = NULL;
+
+  ret = realloc( ptr, size );
+  if( !ret && !size )
+    ret = realloc( ptr, 1 );
+  if( !ret )
+    FATAL_ERROR( "Out of memory, realloc failed" );
+  return ret;
+}
Index: src/wrapper.h
===================================================================
--- src/wrapper.h	(nonexistent)
+++ src/wrapper.h	(revision 71)
@@ -0,0 +1,36 @@
+
+/**********************************************************************
+
+  Copyright 2019 Andrey V.Kosteltsev
+
+  Licensed under the Radix.pro License, Version 1.0 (the "License");
+  you may not use this file  except  in compliance with the License.
+  You may obtain a copy of the License at
+
+     https://radix.pro/licenses/LICENSE-1.0-en_US.txt
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  implied.
+
+ **********************************************************************/
+
+#ifndef _WRAPPER_H_
+#define _WRAPPER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern char *xstrdup( const char *str );
+extern void *xmalloc( size_t size );
+extern void *xrealloc( void *ptr, size_t size );
+
+
+#ifdef __cplusplus
+}  /* ... extern "C" */
+#endif
+
+#endif /* _WRAPPER_H_ */