Revert "Replace use of snprintf with xsprintf"
This reverts commit a7419dbc59.
_All_ changes in that commit were wrong.
Fixes #8211.
This commit is contained in:
+2
-2
@@ -365,7 +365,7 @@ static int write_to_console(
|
|||||||
highlight = LOG_PRI(level) <= LOG_ERR && show_color;
|
highlight = LOG_PRI(level) <= LOG_ERR && show_color;
|
||||||
|
|
||||||
if (show_location) {
|
if (show_location) {
|
||||||
xsprintf(location, "(%s:%i) ", file, line);
|
snprintf(location, sizeof(location), "(%s:%i) ", file, line);
|
||||||
iovec[n++] = IOVEC_MAKE_STRING(location);
|
iovec[n++] = IOVEC_MAKE_STRING(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,7 +800,7 @@ static void log_assert(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||||
xsprintf(buffer, format, text, file, line, func);
|
snprintf(buffer, sizeof buffer, format, text, file, line, func);
|
||||||
REENABLE_WARNING;
|
REENABLE_WARNING;
|
||||||
|
|
||||||
log_abort_msg = buffer;
|
log_abort_msg = buffer;
|
||||||
|
|||||||
+1
-1
@@ -1699,7 +1699,7 @@ static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
|
|||||||
format = unit_get_status_message_format(u, t);
|
format = unit_get_status_message_format(u, t);
|
||||||
|
|
||||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||||
xsprintf(buf, format, unit_description(u));
|
snprintf(buf, sizeof buf, format, unit_description(u));
|
||||||
REENABLE_WARNING;
|
REENABLE_WARNING;
|
||||||
|
|
||||||
mid = t == JOB_START ? "MESSAGE_ID=" SD_MESSAGE_UNIT_STARTING_STR :
|
mid = t == JOB_START ? "MESSAGE_ID=" SD_MESSAGE_UNIT_STARTING_STR :
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ static int prepare(char *dir, char *filename)
|
|||||||
if (r < 0 && errno != EEXIST)
|
if (r < 0 && errno != EEXIST)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
xsprintf(buf, "%s/%s", dir, filename);
|
snprintf(buf, sizeof buf, "%s/%s", dir, filename);
|
||||||
|
|
||||||
fd = open(buf, O_RDWR|O_CREAT|O_CLOEXEC, S_IRUSR|S_IWUSR);
|
fd = open(buf, O_RDWR|O_CREAT|O_CLOEXEC, S_IRUSR|S_IWUSR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
xsprintf(slots, "%s/slots", udev_device_get_syspath(pci));
|
snprintf(slots, sizeof slots, "%s/slots", udev_device_get_syspath(pci));
|
||||||
dir = opendir(slots);
|
dir = opendir(slots);
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
@@ -294,7 +294,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
|
|||||||
if (i < 1)
|
if (i < 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
xsprintf(str, "%s/%s/address", slots, dent->d_name);
|
snprintf(str, sizeof str, "%s/%s/address", slots, dent->d_name);
|
||||||
if (read_one_line_file(str, &address) >= 0) {
|
if (read_one_line_file(str, &address) >= 0) {
|
||||||
/* match slot address with device by stripping the function */
|
/* match slot address with device by stripping the function */
|
||||||
if (strneq(address, udev_device_get_sysname(names->pcidev), strlen(address)))
|
if (strneq(address, udev_device_get_sysname(names->pcidev), strlen(address)))
|
||||||
|
|||||||
Reference in New Issue
Block a user