]> git.saurik.com Git - apple/libc.git/blobdiff - gen/FreeBSD/fmtmsg.c.patch
Libc-825.24.tar.gz
[apple/libc.git] / gen / FreeBSD / fmtmsg.c.patch
diff --git a/gen/FreeBSD/fmtmsg.c.patch b/gen/FreeBSD/fmtmsg.c.patch
deleted file mode 100644 (file)
index 6bbcea4..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
---- fmtmsg.c.orig      2009-11-07 14:51:37.000000000 -0800
-+++ fmtmsg.c   2009-11-07 14:51:39.000000000 -0800
-@@ -31,6 +31,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/fmt
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
- /* Default value for MSGVERB. */
- #define       DFLT_MSGVERB    "label:severity:text:action:tag"
-@@ -55,6 +57,9 @@ fmtmsg(long class, const char *label, in
- {
-       FILE *fp;
-       char *env, *msgverb, *output;
-+      int ret = MM_OK;
-+
-+      if (action == NULL) action = "";
-       if (class & MM_PRINT) {
-               if ((env = getenv("MSGVERB")) != NULL && *env != '\0' &&
-@@ -76,8 +81,12 @@ def:
-                       free(msgverb);
-                       return (MM_NOTOK);
-               }
--              if (*output != '\0')
--                      fprintf(stderr, "%s", output);
-+              if (*output != '\0') {
-+                      int out_len = fprintf(stderr, "%s", output);
-+                      if (out_len < 0) {
-+                          ret = MM_NOMSG;
-+                      }
-+              }
-               free(msgverb);
-               free(output);
-       }
-@@ -87,16 +96,58 @@ def:
-               if (output == NULL)
-                       return (MM_NOCON);
-               if (*output != '\0') {
--                      if ((fp = fopen("/dev/console", "a")) == NULL) {
--                              free(output);
--                              return (MM_NOCON);
-+
-+/*
-+//                        /-------------\
-+//                       /               \
-+//                      /                 \
-+//                     /                   \
-+//                     |   XXXX     XXXX   |
-+//                     |   XXXX     XXXX   |
-+//                     |   XXX       XXX   |
-+//                     \         X         /
-+//                      --\     XXX     /--
-+//                       | |    XXX    | |
-+//                       | |           | |
-+//                       | I I I I I I I |
-+//                       |  I I I I I I  |
-+//                        \             /
-+//                         --         --
-+//                           \-------/
-+//
-+//                      DO NOT INTEGRATE THIS CHANGE
-+//
-+//                      Integrating it means DEATH.
-+//               (see Revelation 6:8 for full details)
-+
-+                      XXX this is a *huge* kludge to pass the SuSv3 tests,
-+                        I don't think of it as cheating because they are
-+                        looking in the wrong place (/realdev/console) to do
-+                        their testing, but they can't look in the "right"
-+                        place for various reasons */
-+                      char *cpath = "/dev/console";
-+                      struct stat sb;
-+                      int rc = stat("/realdev/console", &sb);
-+                      if (rc == 0 && (sb.st_mode & S_IFDIR)) {
-+                          cpath = "/realdev/console";
-+                      }
-+                      /* XXX thus ends the kludge - changes after
-+                        this point may be safely integrated */
-+
-+                      if ((fp = fopen(cpath, "a")) == NULL) {
-+                              if (ret == MM_OK) {
-+                                  ret = MM_NOCON;
-+                              } else {
-+                                  ret = MM_NOTOK;
-+                              }
-+                      } else {
-+                          fprintf(fp, "%s", output);
-+                          fclose(fp);
-                       }
--                      fprintf(fp, "%s", output);
--                      fclose(fp);
-               }
-               free(output);
-       }
--      return (MM_OK);
-+      return (ret);
- }
- #define INSERT_COLON                                                  \