Print this page
2445 savecore fails with dump archive but return EXIT_OK

@@ -19,10 +19,13 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
  */
+/*
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <unistd.h>

@@ -216,24 +219,26 @@
         case SC_EXIT_OK:
                 code = 0;
                 break;
 
         case SC_EXIT_PEND:
+                /*
+                 * Raise an ireport saying why we are exiting.  Do not
+                 * raise if run as savecore -m.  If something in the
+                 * raise_event codepath calls logprint avoid recursion.
+                 */
+                if (!mflag && logprint_raised++ == 0)
+                        raise_event(SC_EVENT_SAVECORE_FAILURE, buf);
                 code = 2;
                 break;
 
         case SC_EXIT_FM:
                 code = 3;
                 break;
 
         case SC_EXIT_ERR:
         default:
-                /*
-                 * Raise an ireport saying why we are exiting.  Do not
-                 * raise if run as savecore -m.  If something in the
-                 * raise_event codepath calls logprint avoid recursion.
-                 */
                 if (!mflag && logprint_raised++ == 0)
                         raise_event(SC_EVENT_SAVECORE_FAILURE, buf);
                 code = 1;
                 break;
         }

@@ -354,30 +359,30 @@
         Pread(dumpfd, &datahdr, sizeof (datahdr), endoff + sizeof (dumphdr));
 
         pagesize = dumphdr.dump_pagesize;
 
         if (dumphdr.dump_magic != DUMP_MAGIC)
-                logprint(SC_SL_NONE | SC_EXIT_OK, "bad magic number %x",
+                logprint(SC_SL_NONE | SC_EXIT_PEND, "bad magic number %x",
                     dumphdr.dump_magic);
 
         if ((dumphdr.dump_flags & DF_VALID) == 0 && !disregard_valid_flag)
                 logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_OK,
                     "dump already processed");
 
         if (dumphdr.dump_version != DUMP_VERSION)
-                logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_OK,
+                logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_PEND,
                     "dump version (%d) != %s version (%d)",
                     dumphdr.dump_version, progname, DUMP_VERSION);
 
         if (dumphdr.dump_wordsize != DUMP_WORDSIZE)
-                logprint(SC_SL_NONE | SC_EXIT_OK,
+                logprint(SC_SL_NONE | SC_EXIT_PEND,
                     "dump is from %u-bit kernel - cannot save on %u-bit kernel",
                     dumphdr.dump_wordsize, DUMP_WORDSIZE);
 
         if (datahdr.dump_datahdr_magic == DUMP_DATAHDR_MAGIC) {
                 if (datahdr.dump_datahdr_version != DUMP_DATAHDR_VERSION)
-                        logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_OK,
+                        logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_PEND,
                             "dump data version (%d) != %s data version (%d)",
                             datahdr.dump_datahdr_version, progname,
                             DUMP_DATAHDR_VERSION);
         } else {
                 (void) memset(&datahdr, 0, sizeof (datahdr));