Date: Mon, 30 Nov 2015 21:25:10 GMT From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r294583 - soc2013/def/crashdump-head/sbin/savecore Message-ID: <201511302125.tAULPA3T060060@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: def Date: Mon Nov 30 21:25:09 2015 New Revision: 294583 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=294583 Log: Log error message. Simplify code. Modified: soc2013/def/crashdump-head/sbin/savecore/savecore.c Modified: soc2013/def/crashdump-head/sbin/savecore/savecore.c ============================================================================== --- soc2013/def/crashdump-head/sbin/savecore/savecore.c Mon Nov 30 21:23:00 2015 (r294582) +++ soc2013/def/crashdump-head/sbin/savecore/savecore.c Mon Nov 30 21:25:09 2015 (r294583) @@ -191,12 +191,13 @@ fd = open(keyname, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd == -1) { - syslog(LOG_ERR, "Unable to open %s to write the key.", keyname); + syslog(LOG_ERR, "Unable to open %s to write the key: %m.", + keyname); return (false); } if (write(fd, dumpkey, dumpkeysize) != (ssize_t)dumpkeysize) { - syslog(LOG_ERR, "Unable to write the key to %s.", keyname); + syslog(LOG_ERR, "Unable to write the key to %s: %m.", keyname); close(fd); return (false); } @@ -705,8 +706,9 @@ xo_finish_h(xoinfo); fclose(info); - isencrypted = false; - if (dumpkeysize > 0) { + if (dumpkeysize == 0) { + isencrypted = false; + } else { isencrypted = true; dumpkey = calloc(1, dumpkeysize); if (dumpkey == NULL) { @@ -715,9 +717,8 @@ goto closeall; } - error = read(fd, dumpkey, dumpkeysize); - if (error != (int)dumpkeysize) { - syslog(LOG_ERR, "Unable to read kernel dump key."); + if (read(fd, dumpkey, dumpkeysize) != (ssize_t)dumpkeysize) { + syslog(LOG_ERR, "Unable to read kernel dump key: %m."); nerr++; goto closeall; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511302125.tAULPA3T060060>