strndup is not portable.
authorayin <ayin>
Wed, 27 Jun 2007 20:26:15 +0000 (20:26 +0000)
committerayin <ayin>
Wed, 27 Jun 2007 20:26:15 +0000 (20:26 +0000)
src/xpm.C

index ed4ae08733e4da20170e1015e33ec7c6178cdecc..9f81373f8d352f05c38f07840c3c033dba9f4db5 100644 (file)
--- a/src/xpm.C
+++ b/src/xpm.C
@@ -412,7 +412,10 @@ rxvt_term::set_bgPixmap (const char *file)
         original_asim = get_asimage( asimman, file, 0xFFFFFFFF, 100 );           
       else
         {
-          f = strndup( file, f - file );
+          size_t len = f - file;
+          f = (char *)malloc (len + 1);
+          strncpy (f, file, len);
+          f[len] = '\0';
           original_asim = get_asimage( asimman, f, 0xFFFFFFFF, 100 );    
           free( f );
         }