Print this page
7475 savecore should not go further if there is no dumpfile

@@ -70,10 +70,11 @@
 static char     *savedir;               /* savecore directory */
 static char     *dumpfile;              /* source of raw crash dump */
 static long     bounds = -1;            /* numeric suffix */
 static long     pagesize;               /* dump pagesize */
 static int      dumpfd = -1;            /* dumpfile descriptor */
+static boolean_t have_dumpfile = B_TRUE;        /* dumpfile existence */
 static dumphdr_t corehdr, dumphdr;      /* initial and terminal dumphdrs */
 static boolean_t dump_incomplete;       /* dumphdr indicates incomplete */
 static boolean_t fm_panic;              /* dump is the result of fm_panic */
 static offset_t endoff;                 /* offset of end-of-dump header */
 static int      verbose;                /* chatty mode */

@@ -237,11 +238,11 @@
                 code = 3;
                 break;
 
         case SC_EXIT_ERR:
         default:
-                if (!mflag && logprint_raised++ == 0)
+                if (!mflag && logprint_raised++ == 0 && have_dumpfile)
                         raise_event(SC_EVENT_SAVECORE_FAILURE, buf);
                 code = 1;
                 break;
         }
 

@@ -297,13 +298,15 @@
 }
 
 static void
 Stat(const char *fname, Stat_t *sb)
 {
-        if (stat64(fname, sb) != 0)
-                logprint(SC_SL_ERR | SC_EXIT_ERR, "stat(\"%s\"): %s", fname,
-                    strerror(errno));
+        if (stat64(fname, sb) != 0) {
+                have_dumpfile = B_FALSE;
+                logprint(SC_SL_ERR | SC_EXIT_ERR, "failed to get status "
+                    "of file %s", fname);
+        }
 }
 
 static void
 Pread(int fd, void *buf, size_t size, offset_t off)
 {

@@ -1709,14 +1712,16 @@
         if (dumpfile == NULL || livedump)
                 dumpfd = Open("/dev/dump", O_RDONLY, 0444);
 
         if (dumpfile == NULL) {
                 dumpfile = Zalloc(MAXPATHLEN);
-                if (ioctl(dumpfd, DIOCGETDEV, dumpfile) == -1)
+                if (ioctl(dumpfd, DIOCGETDEV, dumpfile) == -1) {
+                        have_dumpfile  = B_FALSE;
                         logprint(SC_SL_NONE | SC_IF_ISATTY | SC_EXIT_ERR,
                             "no dump device configured");
         }
+        }
 
         if (mflag)
                 return (message_save());
 
         if (optind == argc - 1)