On this issue:

  http://bugs.r-project.org/cgi-bin/R/incoming?id=14008

Here's a small patch which fixes the problem:


$ svn diff src/main/sysutils.c src/unix/sys-unix.c
Index: src/main/sysutils.c
===================================================================
--- src/main/sysutils.c (revision 49961)
+++ src/main/sysutils.c (working copy)
@@ -260,6 +260,9 @@
 #else
     fp = popen(command, type);
 #endif
+    if (NULL == fp) {
+       error(_("popen failed with errno %i: %s"), errno, strerror(errno));
+    }
     return fp;
 }
 #endif /* HAVE_POPEN */
Index: src/unix/sys-unix.c
===================================================================
--- src/unix/sys-unix.c (revision 49961)
+++ src/unix/sys-unix.c (working copy)
@@ -270,6 +270,11 @@
 
        PROTECT(tlist);
        fp = R_popen(translateChar(STRING_ELT(CAR(args), 0)), x);
+        if (NULL == fp) {
+            UNPROTECT(1);
+            errorcall(call, _("R_popen returned NULL."));
+            return R_NilValue;
+        }
         for (i = 0; fgets(buf, INTERN_BUFSIZE, fp); i++) {
             read = strlen(buf);
                 if(read >= INTERN_BUFSIZE - 1)

-- 
Andrew Piskorski <a...@piskorski.com>
http://www.piskorski.com/

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to