[Midnightbsd-cvs] src [12204] stable/1.1/lib/libmport/bundle_read_install_pkg.c: fix some bugs with pkg message printing
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun May 26 13:22:01 EDT 2019
Revision: 12204
http://svnweb.midnightbsd.org/src/?rev=12204
Author: laffer1
Date: 2019-05-26 13:22:01 -0400 (Sun, 26 May 2019)
Log Message:
-----------
fix some bugs with pkg message printing
Modified Paths:
--------------
stable/1.1/lib/libmport/bundle_read_install_pkg.c
Modified: stable/1.1/lib/libmport/bundle_read_install_pkg.c
===================================================================
--- stable/1.1/lib/libmport/bundle_read_install_pkg.c 2019-05-26 17:08:16 UTC (rev 12203)
+++ stable/1.1/lib/libmport/bundle_read_install_pkg.c 2019-05-26 17:22:01 UTC (rev 12204)
@@ -952,14 +952,15 @@
if ((buf = (char *) calloc((size_t) (st.st_size + 1), sizeof(char))) == NULL)
RETURN_ERROR(MPORT_ERR_FATAL, "Out of memory.");
- if (fread(buf, 1, (size_t) st.st_size, file) != (size_t) st.st_size) {
+ if (fread(buf, sizeof(char), (size_t) st.st_size, file) != (size_t) st.st_size) {
free(buf);
RETURN_ERRORX(MPORT_ERR_FATAL, "Read error: %s", strerror(errno));
}
- buf[st.st_size] = 0;
+ buf[st.st_size] = '\0';
- mport_call_msg_cb(mport, buf);
+ if (buf[0] != '\0')
+ mport_call_msg_cb(mport, "%s", buf);
free(buf);
More information about the Midnightbsd-cvs
mailing list