summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-24 16:39:37 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-24 16:39:37 +0100
commit9f6445e34a57c270f013c9416c123e56261553dd (patch)
tree51bd61c2671a564b1fda28b998dcb3b0ddb4c8ed /src/udev
parentae98841e63a2624700db84ba44217f768b090d99 (diff)
log: log_error() and friends add a newline after each line anyway, so avoid including it in the log strings
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/accelerometer/accelerometer.c2
-rw-r--r--src/udev/ata_id/ata_id.c6
-rw-r--r--src/udev/cdrom_id/cdrom_id.c160
-rw-r--r--src/udev/net/link-config.c2
-rw-r--r--src/udev/scsi_id/scsi_id.c16
-rw-r--r--src/udev/scsi_id/scsi_serial.c60
-rw-r--r--src/udev/udev-builtin-blkid.c2
-rw-r--r--src/udev/udev-builtin-firmware.c10
-rw-r--r--src/udev/udev-builtin-input_id.c14
-rw-r--r--src/udev/udev-builtin-keyboard.c14
-rw-r--r--src/udev/udev-builtin-kmod.c18
-rw-r--r--src/udev/udev-builtin-usb_id.c22
-rw-r--r--src/udev/udev-ctrl.c22
-rw-r--r--src/udev/udev-event.c62
-rw-r--r--src/udev/udev-node.c32
-rw-r--r--src/udev/udev-rules.c186
-rw-r--r--src/udev/udev-watch.c10
-rw-r--r--src/udev/udevadm-hwdb.c42
-rw-r--r--src/udev/udevadm-monitor.c6
-rw-r--r--src/udev/udevadm-settle.c16
-rw-r--r--src/udev/udevadm-test.c4
-rw-r--r--src/udev/udevadm-trigger.c8
-rw-r--r--src/udev/udevadm.c2
-rw-r--r--src/udev/udevd.c114
24 files changed, 415 insertions, 415 deletions
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
index 86966fbd5f..babd66f6b5 100644
--- a/src/udev/accelerometer/accelerometer.c
+++ b/src/udev/accelerometer/accelerometer.c
@@ -335,7 +335,7 @@ int main (int argc, char** argv)
return 0;
}
- log_debug("opening accelerometer device %s\n", devnode);
+ log_debug("opening accelerometer device %s", devnode);
test_orientation(udev, dev, devnode);
free(devnode);
log_close();
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
index 28e9acb296..649890618e 100644
--- a/src/udev/ata_id/ata_id.c
+++ b/src/udev/ata_id/ata_id.c
@@ -463,14 +463,14 @@ int main(int argc, char *argv[])
node = argv[optind];
if (node == NULL) {
- log_error("no node specified\n");
+ log_error("no node specified");
rc = 1;
goto exit;
}
fd = open(node, O_RDONLY|O_NONBLOCK);
if (fd < 0) {
- log_error("unable to open '%s'\n", node);
+ log_error("unable to open '%s'", node);
rc = 1;
goto exit;
}
@@ -502,7 +502,7 @@ int main(int argc, char *argv[])
} else {
/* If this fails, then try HDIO_GET_IDENTITY */
if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) {
- log_debug("HDIO_GET_IDENTITY failed for '%s': %m\n", node);
+ log_debug("HDIO_GET_IDENTITY failed for '%s': %m", node);
rc = 2;
goto close;
}
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index 09d2d69755..c62fbf9c8c 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -138,10 +138,10 @@ static bool is_mounted(const char *device)
static void info_scsi_cmd_err(struct udev *udev, const char *cmd, int err)
{
if (err == -1) {
- log_debug("%s failed\n", cmd);
+ log_debug("%s failed", cmd);
return;
}
- log_debug("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err));
+ log_debug("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh", cmd, SK(err), ASC(err), ASCQ(err));
}
struct scsi_cmd {
@@ -206,11 +206,11 @@ static int media_lock(struct udev *udev, int fd, bool lock)
/* disable the kernel's lock logic */
err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK);
if (err < 0)
- log_debug("CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n");
+ log_debug("CDROM_CLEAR_OPTIONS, CDO_LOCK failed");
err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0);
if (err < 0)
- log_debug("CDROM_LOCKDOOR failed\n");
+ log_debug("CDROM_LOCKDOOR failed");
return err;
}
@@ -238,7 +238,7 @@ static int cd_capability_compat(struct udev *udev, int fd)
capability = ioctl(fd, CDROM_GET_CAPABILITY, NULL);
if (capability < 0) {
- log_debug("CDROM_GET_CAPABILITY failed\n");
+ log_debug("CDROM_GET_CAPABILITY failed");
return -1;
}
@@ -262,7 +262,7 @@ static int cd_capability_compat(struct udev *udev, int fd)
static int cd_media_compat(struct udev *udev, int fd)
{
if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) {
- log_debug("CDROM_DRIVE_STATUS != CDS_DISC_OK\n");
+ log_debug("CDROM_DRIVE_STATUS != CDS_DISC_OK");
return -1;
}
cd_media = 1;
@@ -286,11 +286,11 @@ static int cd_inquiry(struct udev *udev, int fd)
}
if ((inq[0] & 0x1F) != 5) {
- log_debug("not an MMC unit\n");
+ log_debug("not an MMC unit");
return -1;
}
- log_debug("INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32);
+ log_debug("INQUIRY: [%.8s][%.16s][%.4s]", inq + 8, inq + 16, inq + 32);
return 0;
}
@@ -300,105 +300,105 @@ static void feature_profile_media(struct udev *udev, int cur_profile)
case 0x03:
case 0x04:
case 0x05:
- log_debug("profile 0x%02x \n", cur_profile);
+ log_debug("profile 0x%02x ", cur_profile);
cd_media = 1;
cd_media_mo = 1;
break;
case 0x08:
- log_debug("profile 0x%02x media_cd_rom\n", cur_profile);
+ log_debug("profile 0x%02x media_cd_rom", cur_profile);
cd_media = 1;
cd_media_cd_rom = 1;
break;
case 0x09:
- log_debug("profile 0x%02x media_cd_r\n", cur_profile);
+ log_debug("profile 0x%02x media_cd_r", cur_profile);
cd_media = 1;
cd_media_cd_r = 1;
break;
case 0x0a:
- log_debug("profile 0x%02x media_cd_rw\n", cur_profile);
+ log_debug("profile 0x%02x media_cd_rw", cur_profile);
cd_media = 1;
cd_media_cd_rw = 1;
break;
case 0x10:
- log_debug("profile 0x%02x media_dvd_ro\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_ro", cur_profile);
cd_media = 1;
cd_media_dvd_rom = 1;
break;
case 0x11:
- log_debug("profile 0x%02x media_dvd_r\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_r", cur_profile);
cd_media = 1;
cd_media_dvd_r = 1;
break;
case 0x12:
- log_debug("profile 0x%02x media_dvd_ram\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_ram", cur_profile);
cd_media = 1;
cd_media_dvd_ram = 1;
break;
case 0x13:
- log_debug("profile 0x%02x media_dvd_rw_ro\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_rw_ro", cur_profile);
cd_media = 1;
cd_media_dvd_rw = 1;
cd_media_dvd_rw_ro = 1;
break;
case 0x14:
- log_debug("profile 0x%02x media_dvd_rw_seq\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_rw_seq", cur_profile);
cd_media = 1;
cd_media_dvd_rw = 1;
cd_media_dvd_rw_seq = 1;
break;
case 0x1B:
- log_debug("profile 0x%02x media_dvd_plus_r\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_plus_r", cur_profile);
cd_media = 1;
cd_media_dvd_plus_r = 1;
break;
case 0x1A:
- log_debug("profile 0x%02x media_dvd_plus_rw\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_plus_rw", cur_profile);
cd_media = 1;
cd_media_dvd_plus_rw = 1;
break;
case 0x2A:
- log_debug("profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_plus_rw_dl", cur_profile);
cd_media = 1;
cd_media_dvd_plus_rw_dl = 1;
break;
case 0x2B:
- log_debug("profile 0x%02x media_dvd_plus_r_dl\n", cur_profile);
+ log_debug("profile 0x%02x media_dvd_plus_r_dl", cur_profile);
cd_media = 1;
cd_media_dvd_plus_r_dl = 1;
break;
case 0x40:
- log_debug("profile 0x%02x media_bd\n", cur_profile);
+ log_debug("profile 0x%02x media_bd", cur_profile);
cd_media = 1;
cd_media_bd = 1;
break;
case 0x41:
case 0x42:
- log_debug("profile 0x%02x media_bd_r\n", cur_profile);
+ log_debug("profile 0x%02x media_bd_r", cur_profile);
cd_media = 1;
cd_media_bd_r = 1;
break;
case 0x43:
- log_debug("profile 0x%02x media_bd_re\n", cur_profile);
+ log_debug("profile 0x%02x media_bd_re", cur_profile);
cd_media = 1;
cd_media_bd_re = 1;
break;
case 0x50:
- log_debug("profile 0x%02x media_hddvd\n", cur_profile);
+ log_debug("profile 0x%02x media_hddvd", cur_profile);
cd_media = 1;
cd_media_hddvd = 1;
break;
case 0x51:
- log_debug("profile 0x%02x media_hddvd_r\n", cur_profile);
+ log_debug("profile 0x%02x media_hddvd_r", cur_profile);
cd_media = 1;
cd_media_hddvd_r = 1;
break;
case 0x52:
- log_debug("profile 0x%02x media_hddvd_rw\n", cur_profile);
+ log_debug("profile 0x%02x media_hddvd_rw", cur_profile);
cd_media = 1;
cd_media_hddvd_rw = 1;
break;
default:
- log_debug("profile 0x%02x <ignored>\n", cur_profile);
+ log_debug("profile 0x%02x <ignored>", cur_profile);
break;
}
}
@@ -415,77 +415,77 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si
case 0x03:
case 0x04:
case 0x05:
- log_debug("profile 0x%02x mo\n", profile);
+ log_debug("profile 0x%02x mo", profile);
cd_mo = 1;
break;
case 0x08:
- log_debug("profile 0x%02x cd_rom\n", profile);
+ log_debug("profile 0x%02x cd_rom", profile);
cd_cd_rom = 1;
break;
case 0x09:
- log_debug("profile 0x%02x cd_r\n", profile);
+ log_debug("profile 0x%02x cd_r", profile);
cd_cd_r = 1;
break;
case 0x0A:
- log_debug("profile 0x%02x cd_rw\n", profile);
+ log_debug("profile 0x%02x cd_rw", profile);
cd_cd_rw = 1;
break;
case 0x10:
- log_debug("profile 0x%02x dvd_rom\n", profile);
+ log_debug("profile 0x%02x dvd_rom", profile);
cd_dvd_rom = 1;
break;
case 0x12:
- log_debug("profile 0x%02x dvd_ram\n", profile);
+ log_debug("profile 0x%02x dvd_ram", profile);
cd_dvd_ram = 1;
break;
case 0x13:
case 0x14:
- log_debug("profile 0x%02x dvd_rw\n", profile);
+ log_debug("profile 0x%02x dvd_rw", profile);
cd_dvd_rw = 1;
break;
case 0x1B:
- log_debug("profile 0x%02x dvd_plus_r\n", profile);
+ log_debug("profile 0x%02x dvd_plus_r", profile);
cd_dvd_plus_r = 1;
break;
case 0x1A:
- log_debug("profile 0x%02x dvd_plus_rw\n", profile);
+ log_debug("profile 0x%02x dvd_plus_rw", profile);
cd_dvd_plus_rw = 1;
break;
case 0x2A:
- log_debug("profile 0x%02x dvd_plus_rw_dl\n", profile);
+ log_debug("profile 0x%02x dvd_plus_rw_dl", profile);
cd_dvd_plus_rw_dl = 1;
break;
case 0x2B:
- log_debug("profile 0x%02x dvd_plus_r_dl\n", profile);
+ log_debug("profile 0x%02x dvd_plus_r_dl", profile);
cd_dvd_plus_r_dl = 1;
break;
case 0x40:
cd_bd = 1;
- log_debug("profile 0x%02x bd\n", profile);
+ log_debug("profile 0x%02x bd", profile);
break;
case 0x41:
case 0x42:
cd_bd_r = 1;
- log_debug("profile 0x%02x bd_r\n", profile);
+ log_debug("profile 0x%02x bd_r", profile);
break;
case 0x43:
cd_bd_re = 1;
- log_debug("profile 0x%02x bd_re\n", profile);
+ log_debug("profile 0x%02x bd_re", profile);
break;
case 0x50:
cd_hddvd = 1;
- log_debug("profile 0x%02x hddvd\n", profile);
+ log_debug("profile 0x%02x hddvd", profile);
break;
case 0x51:
cd_hddvd_r = 1;
- log_debug("profile 0x%02x hddvd_r\n", profile);
+ log_debug("profile 0x%02x hddvd_r", profile);
break;
case 0x52:
cd_hddvd_rw = 1;
- log_debug("profile 0x%02x hddvd_rw\n", profile);
+ log_debug("profile 0x%02x hddvd_rw", profile);
break;
default:
- log_debug("profile 0x%02x <ignored>\n", profile);
+ log_debug("profile 0x%02x <ignored>", profile);
break;
}
}
@@ -508,13 +508,13 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd)
if ((err != 0)) {
info_scsi_cmd_err(udev, "READ DISC INFORMATION", err);
if (cd_media == 1) {
- log_debug("no current profile, but disc is present; assuming CD-ROM\n");
+ log_debug("no current profile, but disc is present; assuming CD-ROM");
cd_media_cd_rom = 1;
cd_media_track_count = 1;
cd_media_track_count_data = 1;
return 0;
} else {
- log_debug("no current profile, assuming no media\n");
+ log_debug("no current profile, assuming no media");
return -1;
}
};
@@ -523,13 +523,13 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd)
if (header[2] & 16) {
cd_media_cd_rw = 1;
- log_debug("profile 0x0a media_cd_rw\n");
+ log_debug("profile 0x0a media_cd_rw");
} else if ((header[2] & 3) < 2 && cd_cd_r) {
cd_media_cd_r = 1;
- log_debug("profile 0x09 media_cd_r\n");
+ log_debug("profile 0x09 media_cd_r");
} else {
cd_media_cd_rom = 1;
- log_debug("profile 0x08 media_cd_rom\n");
+ log_debug("profile 0x08 media_cd_rom");
}
return 0;
}
@@ -557,8 +557,8 @@ static int cd_profiles(struct udev *udev, int fd)
info_scsi_cmd_err(udev, "GET CONFIGURATION", err);
/* handle pre-MMC2 drives which do not support GET CONFIGURATION */
if (SK(err) == 0x5 && ASC(err) == 0x20) {
- log_debug("drive is pre-MMC2 and does not support 46h get configuration command\n");
- log_debug("trying to work around the problem\n");
+ log_debug("drive is pre-MMC2 and does not support 46h get configuration command");
+ log_debug("trying to work around the problem");
ret = cd_profiles_old_mmc(udev, fd);
}
goto out;
@@ -566,18 +566,18 @@ static int cd_profiles(struct udev *udev, int fd)
cur_profile = features[6] << 8 | features[7];
if (cur_profile > 0) {
- log_debug("current profile 0x%02x\n", cur_profile);
+ log_debug("current profile 0x%02x", cur_profile);
feature_profile_media (udev, cur_profile);
ret = 0; /* we have media */
} else {
- log_debug("no current profile, assuming no media\n");
+ log_debug("no current profile, assuming no media");
}
len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3];
- log_debug("GET CONFIGURATION: size of features buffer 0x%04x\n", len);
+ log_debug("GET CONFIGURATION: size of features buffer 0x%04x", len);
if (len > sizeof(features)) {
- log_debug("can not get features in a single query, truncating\n");
+ log_debug("can not get features in a single query, truncating");
len = sizeof(features);
} else if (len <= 8) {
len = sizeof(features);
@@ -597,10 +597,10 @@ static int cd_profiles(struct udev *udev, int fd)
/* parse the length once more, in case the drive decided to have other features suddenly :) */
len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3];
- log_debug("GET CONFIGURATION: size of features buffer 0x%04x\n", len);
+ log_debug("GET CONFIGURATION: size of features buffer 0x%04x", len);
if (len > sizeof(features)) {
- log_debug("can not get features in a single query, truncating\n");
+ log_debug("can not get features in a single query, truncating");
len = sizeof(features);
}
@@ -612,11 +612,11 @@ static int cd_profiles(struct udev *udev, int fd)
switch (feature) {
case 0x00:
- log_debug("GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4);
+ log_debug("GET CONFIGURATION: feature 'profiles', with %i entries", features[i+3] / 4);
feature_profiles(udev, &features[i]+4, features[i+3]);
break;
default:
- log_debug("GET CONFIGURATION: feature 0x%04x <ignored>, with 0x%02x bytes\n", feature, features[i+3]);
+ log_debug("GET CONFIGURATION: feature 0x%04x <ignored>, with 0x%02x bytes", feature, features[i+3]);
break;
}
}
@@ -647,8 +647,8 @@ static int cd_media_info(struct udev *udev, int fd)
};
cd_media = 1;
- log_debug("disk type %02x\n", header[8]);
- log_debug("hardware reported media status: %s\n", media_status[header[2] & 3]);
+ log_debug("disk type %02x", header[8]);
+ log_debug("hardware reported media status: %s", media_status[header[2] & 3]);
/* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */
if (!cd_media_cd_rom)
@@ -686,7 +686,7 @@ static int cd_media_info(struct udev *udev, int fd)
}
if (dvdstruct[4] & 0x02) {
cd_media_state = media_status[2];
- log_debug("write-protected DVD-RAM media inserted\n");
+ log_debug("write-protected DVD-RAM media inserted");
goto determined;
}
@@ -703,13 +703,13 @@ static int cd_media_info(struct udev *udev, int fd)
len = format[3];
if (len & 7 || len < 16) {
- log_debug("invalid format capacities length\n");
+ log_debug("invalid format capacities length");
return -1;
}
switch(format[8] & 3) {
case 1:
- log_debug("unformatted DVD-RAM media inserted\n");
+ log_debug("unformatted DVD-RAM media inserted");
/* This means that last format was interrupted
* or failed, blank dvd-ram discs are factory
* formatted. Take no action here as it takes
@@ -718,12 +718,12 @@ static int cd_media_info(struct udev *udev, int fd)
goto determined;
case 2:
- log_debug("formatted DVD-RAM media inserted\n");
+ log_debug("formatted DVD-RAM media inserted");
break;
case 3:
cd_media = 0; //return no media
- log_debug("format capacities returned no media\n");
+ log_debug("format capacities returned no media");
return -1;
}
}
@@ -759,9 +759,9 @@ static int cd_media_info(struct udev *udev, int fd)
if (!result) {
cd_media_state = media_status[0];
- log_debug("no data in blocks 0 or 16, assuming blank\n");
+ log_debug("no data in blocks 0 or 16, assuming blank");
} else {
- log_debug("data in blocks 0 or 16, assuming complete\n");
+ log_debug("data in blocks 0 or 16, assuming complete");
}
}
@@ -797,7 +797,7 @@ static int cd_media_toc(struct udev *udev, int fd)
}
len = (header[0] << 8 | header[1]) + 2;
- log_debug("READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]);
+ log_debug("READ TOC: len: %d, start track: %d, end track: %d", len, header[2], header[3]);
if (len > sizeof(toc))
return -1;
if (len < 2)
@@ -831,7 +831,7 @@ static int cd_media_toc(struct udev *udev, int fd)
is_data_track = (p[1] & 0x04) != 0;
block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7];
- log_debug("track=%u info=0x%x(%s) start_block=%u\n",
+ log_debug("track=%u info=0x%x(%s) start_block=%u",
p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block);
if (is_data_track)
@@ -851,7 +851,7 @@ static int cd_media_toc(struct udev *udev, int fd)
return -1;
}
len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7];
- log_debug("last track %u starts at block %u\n", header[4+2], len);
+ log_debug("last track %u starts at block %u", header[4+2], len);
cd_media_session_last_offset = (unsigned long long int)len * 2048;
return 0;
}
@@ -920,7 +920,7 @@ int main(int argc, char *argv[])
node = argv[optind];
if (!node) {
- log_error("no device\n");
+ log_error("no device");
fprintf(stderr, "no device\n");
rc = 1;
goto exit;
@@ -938,12 +938,12 @@ int main(int argc, char *argv[])
nanosleep(&duration, NULL);
}
if (fd < 0) {
- log_debug("unable to open '%s'\n", node);
+ log_debug("unable to open '%s'", node);
fprintf(stderr, "unable to open '%s'\n", node);
rc = 1;
goto exit;
}
- log_debug("probing: '%s'\n", node);
+ log_debug("probing: '%s'", node);
/* same data as original cdrom_id */
if (cd_capability_compat(udev, fd) < 0) {
@@ -974,19 +974,19 @@ int main(int argc, char *argv[])
work:
/* lock the media, so we enable eject button events */
if (lock && cd_media) {
- log_debug("PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n");
+ log_debug("PREVENT_ALLOW_MEDIUM_REMOVAL (lock)");
media_lock(udev, fd, true);
}
if (unlock && cd_media) {
- log_debug("PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n");
+ log_debug("PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)");
media_lock(udev, fd, false);
}
if (eject) {
- log_debug("PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n");
+ log_debug("PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)");
media_lock(udev, fd, false);
- log_debug("START_STOP_UNIT (eject)\n");
+ log_debug("START_STOP_UNIT (eject)");
media_eject(udev, fd);
}
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index e6618b8cbf..a31c121076 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -86,7 +86,7 @@ int link_config_ctx_new(link_config_ctx **ret) {
}
if (!path_strv_canonicalize_uniq(ctx->link_dirs)) {
- log_error("failed to canonicalize link config directories\n");
+ log_error("failed to canonicalize link config directories");
return -ENOMEM;
}
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index 6a4cf0c09e..03bd3a9182 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -184,7 +184,7 @@ static int get_file_options(struct udev *udev,
if (errno == ENOENT)
return 1;
else {
- log_error("can't open %s: %m\n", config_file);
+ log_error("can't open %s: %m", config_file);
return -1;
}
}
@@ -208,7 +208,7 @@ static int get_file_options(struct udev *udev,
break;
lineno++;
if (buf[strlen(buffer) - 1] != '\n') {
- log_error("Config file line %d too long\n", lineno);
+ log_error("Config file line %d too long", lineno);
break;
}
@@ -257,7 +257,7 @@ static int get_file_options(struct udev *udev,
* Only allow: [vendor=foo[,model=bar]]options=stuff
*/
if (!options_in || (!vendor_in && model_in)) {
- log_error("Error parsing config file line %d '%s'\n", lineno, buffer);
+ log_error("Error parsing config file line %d '%s'", lineno, buffer);
retval = -1;
break;
}
@@ -372,7 +372,7 @@ static int set_options(struct udev *udev,
else if (streq(optarg, "pre-spc3-83"))
default_page_code = PAGE_83_PRE_SPC3;
else {
- log_error("Unknown page code '%s'\n", optarg);
+ log_error("Unknown page code '%s'", optarg);
return -1;
}
break;
@@ -380,7 +380,7 @@ static int set_options(struct udev *udev,
case 's':
sg_version = atoi(optarg);
if (sg_version < 3 || sg_version > 4) {
- log_error("Unknown SG version '%s'\n", optarg);
+ log_error("Unknown SG version '%s'", optarg);
return -1;
}
break;
@@ -453,13 +453,13 @@ static int per_dev_options(struct udev *udev,
} else if (streq(optarg, "pre-spc3-83")) {
*page_code = PAGE_83_PRE_SPC3;
} else {
- log_error("Unknown page code '%s'\n", optarg);
+ log_error("Unknown page code '%s'", optarg);
retval = -1;
}
break;
default:
- log_error("Unknown or bad option '%c' (0x%x)\n", option, option);
+ log_error("Unknown or bad option '%c' (0x%x)", option, option);
retval = -1;
break;
}
@@ -615,7 +615,7 @@ int main(int argc, char **argv)
exit(1);
if (!dev_specified) {
- log_error("no device specified\n");
+ log_error("no device specified");
retval = 1;
goto exit;
}
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
index 4b0711b447..66e752e426 100644
--- a/src/udev/scsi_id/scsi_serial.c
+++ b/src/udev/scsi_id/scsi_serial.c
@@ -197,7 +197,7 @@ static int scsi_dump_sense(struct udev *udev,
*/
if (sb_len < 1) {
- log_debug("%s: sense buffer empty\n", dev_scsi->kernel);
+ log_debug("%s: sense buffer empty", dev_scsi->kernel);
return -1;
}
@@ -210,7 +210,7 @@ static int scsi_dump_sense(struct udev *udev,
*/
s = sense_buffer[7] + 8;
if (sb_len < s) {
- log_debug("%s: sense buffer too small %d bytes, %d bytes too short\n",
+ log_debug("%s: sense buffer too small %d bytes, %d bytes too short",
dev_scsi->kernel, sb_len, s - sb_len);
return -1;
}
@@ -220,7 +220,7 @@ static int scsi_dump_sense(struct udev *udev,
/*
* Possible?
*/
- log_debug("%s: sense result too" " small %d bytes\n",
+ log_debug("%s: sense result too" " small %d bytes",
dev_scsi->kernel, s);
return -1;
}
@@ -231,25 +231,25 @@ static int scsi_dump_sense(struct udev *udev,
asc = sense_buffer[2];
ascq = sense_buffer[3];
} else {
- log_debug("%s: invalid sense code 0x%x\n",
+ log_debug("%s: invalid sense code 0x%x",
dev_scsi->kernel, code);
return -1;
}
- log_debug("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n",
+ log_debug("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x",
dev_scsi->kernel, sense_key, asc, ascq);
} else {
if (sb_len < 4) {
- log_debug("%s: sense buffer too small %d bytes, %d bytes too short\n",
+ log_debug("%s: sense buffer too small %d bytes, %d bytes too short",
dev_scsi->kernel, sb_len, 4 - sb_len);
return -1;
}
if (sense_buffer[0] < 15)
- log_debug("%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f);
+ log_debug("%s: old sense key: 0x%x", dev_scsi->kernel, sense_buffer[0] & 0x0f);
else
- log_debug("%s: sense = %2x %2x\n",
+ log_debug("%s: sense = %2x %2x",
dev_scsi->kernel, sense_buffer[0], sense_buffer[2]);
- log_debug("%s: non-extended sense class %d code 0x%0x\n",
+ log_debug("%s: non-extended sense class %d code 0x%0x",
dev_scsi->kernel, sense_class, code);
}
@@ -261,8 +261,8 @@ static int scsi_dump_sense(struct udev *udev,
out_buffer[j++] = ' ';
}
out_buffer[j] = '\0';
- log_debug("%s: sense dump:\n", dev_scsi->kernel);
- log_debug("%s: %s\n", dev_scsi->kernel, out_buffer);
+ log_debug("%s: sense dump:", dev_scsi->kernel);
+ log_debug("%s: %s", dev_scsi->kernel, out_buffer);
#endif
return -1;
@@ -276,11 +276,11 @@ static int scsi_dump(struct udev *udev,
/*
* Impossible, should not be called.
*/
- log_debug("%s: called with no error\n", __FUNCTION__);
+ log_debug("%s: called with no error", __FUNCTION__);
return -1;
}
- log_debug("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n",
+ log_debug("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x",
dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status);
if (io->status == SCSI_CHECK_CONDITION)
return scsi_dump_sense(udev, dev_scsi, io->sbp, io->sb_len_wr);
@@ -296,11 +296,11 @@ static int scsi_dump_v4(struct udev *udev,
/*
* Impossible, should not be called.
*/
- log_debug("%s: called with no error\n", __FUNCTION__);
+ log_debug("%s: called with no error", __FUNCTION__);
return -1;
}
- log_debug("%s: sg_io failed status 0x%x 0x%x 0x%x\n",
+ log_debug("%s: sg_io failed status 0x%x 0x%x 0x%x",
dev_scsi->kernel, io->driver_status, io->transport_status,
io->device_status);
if (io->device_status == SCSI_CHECK_CONDITION)
@@ -325,7 +325,7 @@ static int scsi_inquiry(struct udev *udev,
int retval;
if (buflen > SCSI_INQ_BUFF_LEN) {
- log_debug("buflen %d too long\n", buflen);
+ log_debug("buflen %d too long", buflen);
return -1;
}
@@ -362,7 +362,7 @@ resend:
dev_scsi->use_sg = 3;
goto resend;
}
- log_debug("%s: ioctl failed: %m\n", dev_scsi->kernel);
+ log_debug("%s: ioctl failed: %m", dev_scsi->kernel);
goto error;
}
@@ -397,7 +397,7 @@ resend:
error:
if (retval < 0)
- log_debug("%s: Unable to get INQUIRY vpd %d page 0x%x.\n",
+ log_debug("%s: Unable to get INQUIRY vpd %d page 0x%x.",
dev_scsi->kernel, evpd, page);
return retval;
@@ -416,11 +416,11 @@ static int do_scsi_page0_inquiry(struct udev *udev,
return 1;
if (buffer[1] != 0) {
- log_debug("%s: page 0 not available.\n", dev_scsi->kernel);
+ log_debug("%s: page 0 not available.", dev_scsi->kernel);
return 1;
}
if (buffer[3] > len) {
- log_debug("%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]);
+ log_debug("%s: page 0 buffer too long %d", dev_scsi->kernel, buffer[3]);
return 1;
}
@@ -437,7 +437,7 @@ static int do_scsi_page0_inquiry(struct udev *udev,
* invalid.
*/
if (strneq((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) {
- log_debug("%s: invalid page0 data\n", dev_scsi->kernel);
+ log_debug("%s: invalid page0 data", dev_scsi->kernel);
return 1;
}
}
@@ -462,7 +462,7 @@ static int prepend_vendor_model(struct udev *udev,
* above, ind will never be too large.
*/
if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) {
- log_debug("%s: expected length %d, got length %d\n",
+ log_debug("%s: expected length %d, got length %d",
dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind);
return -1;
}
@@ -528,7 +528,7 @@ static int check_fill_0x83_id(struct udev *udev,
len += VENDOR_LENGTH + MODEL_LENGTH;
if (max_len < len) {
- log_debug("%s: length %d too short - need %d\n",
+ log_debug("%s: length %d too short - need %d",
dev_scsi->kernel, max_len, len);
return 1;
}
@@ -629,7 +629,7 @@ static int do_scsi_page83_inquiry(struct udev *udev,
return 1;
if (page_83[1] != PAGE_83) {
- log_debug("%s: Invalid page 0x83\n", dev_scsi->kernel);
+ log_debug("%s: Invalid page 0x83", dev_scsi->kernel);
return 1;
}
@@ -715,7 +715,7 @@ static int do_scsi_page83_prespc3_inquiry(struct udev *udev,
return 1;
if (page_83[1] != PAGE_83) {
- log_debug("%s: Invalid page 0x83\n", dev_scsi->kernel);
+ log_debug("%s: Invalid page 0x83", dev_scsi->kernel);
return 1;
}
/*
@@ -779,13 +779,13 @@ static int do_scsi_page80_inquiry(struct udev *udev,
return retval;
if (buf[1] != PAGE_80) {
- log_debug("%s: Invalid page 0x80\n", dev_scsi->kernel);
+ log_debug("%s: Invalid page 0x80", dev_scsi->kernel);
return 1;
}
len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3];
if (max_len < len) {
- log_debug("%s: length %d too short - need %d\n",
+ log_debug("%s: length %d too short - need %d",
dev_scsi->kernel, max_len, len);
return 1;
}
@@ -820,12 +820,12 @@ int scsi_std_inquiry(struct udev *udev,
fd = open(devname, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
- log_debug("scsi_id: cannot open %s: %m\n", devname);
+ log_debug("scsi_id: cannot open %s: %m", devname);
return 1;
}
if (fstat(fd, &statbuf) < 0) {
- log_debug("scsi_id: cannot stat %s: %m\n", devname);
+ log_debug("scsi_id: cannot stat %s: %m", devname);
err = 2;
goto out;
}
@@ -918,7 +918,7 @@ int scsi_get_serial(struct udev *udev,
goto completed;
}
} else if (page_code != 0x00) {
- log_debug("%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code);
+ log_debug("%s: unsupported page code 0x%d", dev_scsi->kernel, page_code);
retval = 1;
goto completed;
}
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index b48dccc2fb..c806bd6ad8 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -190,7 +190,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
if (err < 0)
goto out;
- log_debug("probe %s %sraid offset=%llu\n",
+ log_debug("probe %s %sraid offset=%llu",
udev_device_get_devnode(dev),
noraid ? "no" : "", (unsigned long long) offset);
diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c
index b80940b6ef..8cfeed663b 100644
--- a/src/udev/udev-builtin-firmware.c
+++ b/src/udev/udev-builtin-firmware.c
@@ -33,7 +33,7 @@ static bool set_loading(struct udev *udev, char *loadpath, const char *state)
ldfile = fopen(loadpath, "we");
if (ldfile == NULL) {
- log_error("error: can not open '%s'\n", loadpath);
+ log_error("error: can not open '%s'", loadpath);
return false;
};
fprintf(ldfile, "%s\n", state);
@@ -53,7 +53,7 @@ static bool copy_firmware(struct udev *udev, const char *source, const char *tar
return false;
}
- log_debug("writing '%s' (%zi) to '%s'\n", source, size, target);
+ log_debug("writing '%s' (%zi) to '%s'", source, size, target);
fsource = fopen(source, "re");
if (fsource == NULL)
@@ -90,7 +90,7 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
firmware = udev_device_get_property_value(dev, "FIRMWARE");
if (firmware == NULL) {
- log_error("firmware parameter missing\n\n");
+ log_error("firmware parameter missing");
rc = EXIT_FAILURE;
goto exit;
}
@@ -112,7 +112,7 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL);
if (fwfile == NULL) {
- log_debug("did not find firmware file '%s'\n", firmware);
+ log_debug("did not find firmware file '%s'", firmware);
rc = EXIT_FAILURE;
/*
* Do not cancel the request in the initrd, the real root might have
@@ -136,7 +136,7 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL);
if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) {
- log_error("error sending firmware '%s' to device\n", firmware);
+ log_error("error sending firmware '%s' to device", firmware);
set_loading(udev, loadpath, "-1");
rc = EXIT_FAILURE;
goto exit;
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
index 445b602f9c..4691fc073d 100644
--- a/src/udev/udev-builtin-input_id.c
+++ b/src/udev/udev-builtin-input_id.c
@@ -57,7 +57,7 @@ static void get_cap_mask(struct udev_device *dev,
unsigned long val;
snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr));
- log_debug("%s raw kernel attribute: %s\n", attr, text);
+ log_debug("%s raw kernel attribute: %s", attr, text);
memset (bitmask, 0, bitmask_size);
i = 0;
@@ -66,7 +66,7 @@ static void get_cap_mask(struct udev_device *dev,
if (i < bitmask_size/sizeof(unsigned long))
bitmask[i] = val;
else
- log_debug("ignoring %s block %lX which is larger than maximum size\n", attr, val);
+ log_debug("ignoring %s block %lX which is larger than maximum size", attr, val);
*word = '\0';
++i;
}
@@ -74,12 +74,12 @@ static void get_cap_mask(struct udev_device *dev,
if (i < bitmask_size / sizeof(unsigned long))
bitmask[i] = val;
else
- log_debug("ignoring %s block %lX which is larger than maximum size\n", attr, val);
+ log_debug("ignoring %s block %lX which is larger than maximum size", attr, val);
if (test) {
/* printf pattern with the right unsigned long number of hex chars */
snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long));
- log_debug("%s decoded bit map:\n", attr);
+ log_debug("%s decoded bit map:", attr);
val = bitmask_size / sizeof (unsigned long);
/* skip over leading zeros */
while (bitmask[val-1] == 0 && val > 0)
@@ -151,7 +151,7 @@ static void test_key (struct udev_device *dev,
/* do we have any KEY_* capability? */
if (!test_bit (EV_KEY, bitmask_ev)) {
- log_debug("test_key: no EV_KEY capability\n");
+ log_debug("test_key: no EV_KEY capability");
return;
}
@@ -159,13 +159,13 @@ static void test_key (struct udev_device *dev,
found = 0;
for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) {
found |= bitmask_key[i];
- log_debug("test_key: checking bit block %lu for any keys; found=%i\n", (unsigned long)i*BITS_PER_LONG, found > 0);
+ log_debug("test_key: checking bit block %lu for any keys; found=%i", (unsigned long)i*BITS_PER_LONG, found > 0);
}
/* If there are no keys in the lower block, check the higher block */
if (!found) {
for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) {
if (test_bit (i, bitmask_key)) {
- log_debug("test_key: Found key %x in high block\n", i);
+ log_debug("test_key: Found key %x in high block", i);
found = 1;
break;
}
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index b510a42eb9..614e44ec76 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -59,7 +59,7 @@ static int install_force_release(struct udev_device *dev, const unsigned int *re
for (i = 0; i < release_count; i++)
l = strpcpyf(&s, l, ",%d", release[i]);
- log_debug("keyboard: updating force-release list with '%s'\n", codes);
+ log_debug("keyboard: updating force-release list with '%s'", codes);
ret = udev_device_set_sysattr_value(atkbd, "force_release", codes);
if (ret < 0)
log_error("Error writing force-release attribute: %s", strerror(-ret));
@@ -90,7 +90,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
/* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
scancode = strtoul(key + 13, &endptr, 16);
if (endptr[0] != '\0') {
- log_error("Error, unable to parse scan code from '%s'\n", key);
+ log_error("Error, unable to parse scan code from '%s'", key);
continue;
}
@@ -111,7 +111,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
/* translate identifier to key code */
k = keyboard_lookup_key(keycode, strlen(keycode));
if (!k) {
- log_error("Error, unknown key identifier '%s'\n", keycode);
+ log_error("Error, unknown key identifier '%s'", keycode);
continue;
}
@@ -128,22 +128,22 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
node = udev_device_get_devnode(dev);
if (!node) {
- log_error("Error, no device node for '%s'\n", udev_device_get_syspath(dev));
+ log_error("Error, no device node for '%s'", udev_device_get_syspath(dev));
return EXIT_FAILURE;
}
fd = open(udev_device_get_devnode(dev), O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (fd < 0) {
- log_error("Error, opening device '%s': %m\n", node);
+ log_error("Error, opening device '%s': %m", node);
return EXIT_FAILURE;
}
/* install list of map codes */
for (i = 0; i < map_count; i++) {
- log_debug("keyboard: mapping scan code %d (0x%x) to key code %d (0x%x)\n",
+ log_debug("keyboard: mapping scan code %d (0x%x) to key code %d (0x%x)",
map[i].scan, map[i].scan, map[i].key, map[i].key);
if (ioctl(fd, EVIOCSKEYCODE, &map[i]) < 0)
- log_error("Error calling EVIOCSKEYCODE (scan code 0x%x, key code %d): %m\n", map[i].scan, map[i].key);
+ log_error("Error calling EVIOCSKEYCODE (scan code 0x%x, key code %d): %m", map[i].scan, map[i].key);
}
/* install list of force-release codes */
diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c
index 63dbf30727..5880c38842 100644
--- a/src/udev/udev-builtin-kmod.c
+++ b/src/udev/udev-builtin-kmod.c
@@ -44,18 +44,18 @@ static int load_module(struct udev *udev, const char *alias)
return err;
if (list == NULL)
- log_debug("no module matches '%s'\n", alias);
+ log_debug("no module matches '%s'", alias);
kmod_list_foreach(l, list) {
struct kmod_module *mod = kmod_module_get_module(l);
err = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST, NULL, NULL, NULL, NULL);
if (err == KMOD_PROBE_APPLY_BLACKLIST)
- log_debug("module '%s' is blacklisted\n", kmod_module_get_name(mod));
+ log_debug("module '%s' is blacklisted", kmod_module_get_name(mod));
else if (err == 0)
- log_debug("inserted '%s'\n", kmod_module_get_name(mod));
+ log_debug("inserted '%s'", kmod_module_get_name(mod));
else
- log_debug("failed to insert '%s'\n", kmod_module_get_name(mod));
+ log_debug("failed to insert '%s'", kmod_module_get_name(mod));
kmod_module_unref(mod);
}
@@ -80,12 +80,12 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te
return 0;
if (argc < 3 || !streq(argv[1], "load")) {
- log_error("expect: %s load <module>\n", argv[0]);
+ log_error("expect: %s load <module>", argv[0]);
return EXIT_FAILURE;
}
for (i = 2; argv[i]; i++) {
- log_debug("execute '%s' '%s'\n", argv[1], argv[i]);
+ log_debug("execute '%s' '%s'", argv[1], argv[i]);
load_module(udev, argv[i]);
}
@@ -102,7 +102,7 @@ static int builtin_kmod_init(struct udev *udev)
if (!ctx)
return -ENOMEM;
- log_debug("load module index\n");
+ log_debug("load module index");
kmod_set_log_fn(ctx, udev_kmod_log, udev);
kmod_load_resources(ctx);
return 0;
@@ -111,14 +111,14 @@ static int builtin_kmod_init(struct udev *udev)
/* called on udev shutdown and reload request */
static void builtin_kmod_exit(struct udev *udev)
{
- log_debug("unload module index\n");
+ log_debug("unload module index");
ctx = kmod_unref(ctx);
}
/* called every couple of seconds during event activity; 'true' if config has changed */
static bool builtin_kmod_validate(struct udev *udev)
{
- log_debug("validate module index\n");
+ log_debug("validate module index");
if (!ctx)
return false;
return (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK);
diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c
index 3e2f43e1a6..1b9f8246fb 100644
--- a/src/udev/udev-builtin-usb_id.c
+++ b/src/udev/udev-builtin-usb_id.c
@@ -275,7 +275,7 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool
/* usb interface directory */
dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface");
if (dev_interface == NULL) {
- log_debug("unable to access usb_interface device of '%s'\n",
+ log_debug("unable to access usb_interface device of '%s'",
udev_device_get_syspath(dev));
return EXIT_FAILURE;
}
@@ -285,7 +285,7 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool
if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass");
if (!if_class) {
- log_debug("%s: cannot get bInterfaceClass attribute\n",
+ log_debug("%s: cannot get bInterfaceClass attribute",
udev_device_get_sysname(dev));
return EXIT_FAILURE;
}
@@ -300,13 +300,13 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool
set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1);
}
- log_debug("%s: if_class %d protocol %d\n",
+ log_debug("%s: if_class %d protocol %d",
udev_device_get_syspath(dev_interface), if_class_num, protocol);
/* usb device directory */
dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device");
if (!dev_usb) {
- log_debug("unable to find parent 'usb' device of '%s'\n",
+ log_debug("unable to find parent 'usb' device of '%s'",
udev_device_get_syspath(dev));
return EXIT_FAILURE;
}
@@ -323,19 +323,19 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool
/* get scsi device */
dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device");
if (dev_scsi == NULL) {
- log_debug("unable to find parent 'scsi' device of '%s'\n",
+ log_debug("unable to find parent 'scsi' device of '%s'",
udev_device_get_syspath(dev));
goto fallback;
}
if (sscanf(udev_device_get_sysname(dev_scsi), "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) {
- log_debug("invalid scsi device '%s'\n", udev_device_get_sysname(dev_scsi));
+ log_debug("invalid scsi device '%s'", udev_device_get_sysname(dev_scsi));
goto fallback;
}
/* Generic SPC-2 device */
scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor");
if (!scsi_vendor) {
- log_debug("%s: cannot get SCSI vendor attribute\n",
+ log_debug("%s: cannot get SCSI vendor attribute",
udev_device_get_sysname(dev_scsi));
goto fallback;
}
@@ -345,7 +345,7 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool
scsi_model = udev_device_get_sysattr_value(dev_scsi, "model");
if (!scsi_model) {
- log_debug("%s: cannot get SCSI model attribute\n",
+ log_debug("%s: cannot get SCSI model attribute",
udev_device_get_sysname(dev_scsi));
goto fallback;
}
@@ -355,7 +355,7 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool
scsi_type = udev_device_get_sysattr_value(dev_scsi, "type");
if (!scsi_type) {
- log_debug("%s: cannot get SCSI type attribute\n",
+ log_debug("%s: cannot get SCSI type attribute",
udev_device_get_sysname(dev_scsi));
goto fallback;
}
@@ -363,7 +363,7 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool
scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev");
if (!scsi_rev) {
- log_debug("%s: cannot get SCSI revision attribute\n",
+ log_debug("%s: cannot get SCSI revision attribute",
udev_device_get_sysname(dev_scsi));
goto fallback;
}
@@ -389,7 +389,7 @@ fallback:
if (!usb_vendor)
usb_vendor = vendor_id;
if (!usb_vendor) {
- log_debug("No USB vendor information available\n");
+ log_debug("No USB vendor information available");
return EXIT_FAILURE;
}
udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc));
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 39d777ec73..26879864b0 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -84,7 +84,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd)
if (fd < 0) {
uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0);
if (uctrl->sock < 0) {
- log_error("error getting socket: %m\n");
+ log_error("error getting socket: %m");
udev_ctrl_unref(uctrl);
return NULL;
}
@@ -118,14 +118,14 @@ int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl)
if (err < 0) {
err = -errno;
- log_error("bind failed: %m\n");
+ log_error("bind failed: %m");
return err;
}
err = listen(uctrl->sock, 0);
if (err < 0) {
err = -errno;
- log_error("listen failed: %m\n");
+ log_error("listen failed: %m");
return err;
}
@@ -193,7 +193,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK);
if (conn->sock < 0) {
if (errno != EINTR)
- log_error("unable to receive ctrl connection: %m\n");
+ log_error("unable to receive ctrl connection: %m");
goto err;
}
@@ -204,7 +204,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
goto err;
}
if (ucred.uid > 0) {
- log_error("sender uid=%i, message ignored\n", ucred.uid);
+ log_error("sender uid=%i, message ignored", ucred.uid);
goto err;
}
@@ -372,11 +372,11 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn)
continue;
goto err;
} else if (r == 0) {
- log_error("timeout waiting for ctrl message\n");
+ log_error("timeout waiting for ctrl message");
goto err;
} else {
if (!(pfd[0].revents & POLLIN)) {
- log_error("ctrl connection error: %m\n");
+ log_error("ctrl connection error: %m");
goto err;
}
}
@@ -389,24 +389,24 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn)
size = recvmsg(conn->sock, &smsg, 0);
if (size < 0) {
- log_error("unable to receive ctrl message: %m\n");
+ log_error("unable to receive ctrl message: %m");
goto err;
}
cmsg = CMSG_FIRSTHDR(&smsg);
cred = (struct ucred *) CMSG_DATA(cmsg);
if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
- log_error("no sender credentials received, message ignored\n");
+ log_error("no sender credentials received, message ignored");
goto err;
}
if (cred->uid != 0) {
- log_error("sender uid=%i, message ignored\n", cred->uid);
+ log_error("sender uid=%i, message ignored", cred->uid);
goto err;
}
if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) {
- log_error("message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic);
+ log_error("message magic 0x%08x doesn't match, ignore it", uctrl_msg->ctrl_msg_wire.magic);
goto err;
}
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 0d1049cf1c..5aec077043 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -175,7 +175,7 @@ subst:
from++;
for (i = 0; from[i] != '}'; i++) {
if (from[i] == '\0') {
- log_error("missing closing brace for format '%s'\n", src);
+ log_error("missing closing brace for format '%s'", src);
goto out;
}
}
@@ -256,7 +256,7 @@ subst:
cpos++;
}
if (i > 0) {
- log_error("requested part of result string not found\n");
+ log_error("requested part of result string not found");
break;
}
strscpy(tmp, sizeof(tmp), cpos);
@@ -279,7 +279,7 @@ subst:
int count;
if (attr == NULL) {
- log_error("missing file parameter for attr\n");
+ log_error("missing file parameter for attr");
break;
}
@@ -306,7 +306,7 @@ subst:
vbuf[len] = '\0';
count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT);
if (count > 0)
- log_debug("%i character(s) replaced\n" , count);
+ log_debug("%i character(s) replaced" , count);
l = strpcpy(&s, l, vbuf);
break;
}
@@ -364,7 +364,7 @@ subst:
break;
}
default:
- log_error("unknown substitution type=%i\n", type);
+ log_error("unknown substitution type=%i", type);
break;
}
}
@@ -391,7 +391,7 @@ static int spawn_exec(struct udev_event *event,
dup2(fd, STDERR_FILENO);
close(fd);
} else {
- log_error("open /dev/null failed: %m\n");
+ log_error("open /dev/null failed: %m");
}
/* connect pipes to std{out,err} */
@@ -415,7 +415,7 @@ static int spawn_exec(struct udev_event *event,
/* exec failed */
err = -errno;
- log_error("failed to execute '%s' '%s': %m\n", argv[0], cmd);
+ log_error("failed to execute '%s' '%s': %m", argv[0], cmd);
return err;
}
@@ -434,7 +434,7 @@ static void spawn_read(struct udev_event *event,
fd_ep = epoll_create1(EPOLL_CLOEXEC);
if (fd_ep < 0) {
- log_error("error creating epoll fd: %m\n");
+ log_error("error creating epoll fd: %m");
goto out;
}
@@ -443,7 +443,7 @@ static void spawn_read(struct udev_event *event,
ep_outpipe.events = EPOLLIN;
ep_outpipe.data.ptr = &fd_stdout;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) {
- log_error("fail to add fd to epoll: %m\n");
+ log_error("fail to add fd to epoll: %m");
goto out;
}
}
@@ -453,7 +453,7 @@ static void spawn_read(struct udev_event *event,
ep_errpipe.events = EPOLLIN;
ep_errpipe.data.ptr = &fd_stderr;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) {
- log_error("fail to add fd to epoll: %m\n");
+ log_error("fail to add fd to epoll: %m");
goto out;
}
}
@@ -470,7 +470,7 @@ static void spawn_read(struct udev_event *event,
age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
if (age_usec >= event->timeout_usec) {
- log_error("timeout '%s'\n", cmd);
+ log_error("timeout '%s'", cmd);
goto out;
}
timeout = ((event->timeout_usec - age_usec) / 1000) + 1000;
@@ -482,11 +482,11 @@ static void spawn_read(struct udev_event *event,
if (fdcount < 0) {
if (errno == EINTR)
continue;
- log_error("failed to poll: %m\n");
+ log_error("failed to poll: %m");
goto out;
}
if (fdcount == 0) {
- log_error("timeout '%s'\n", cmd);
+ log_error("timeout '%s'", cmd);
goto out;
}
@@ -508,7 +508,7 @@ static void spawn_read(struct udev_event *event,
memcpy(&result[respos], buf, count);
respos += count;
} else {
- log_error("'%s' ressize %zd too short\n", cmd, ressize);
+ log_error("'%s' ressize %zd too short", cmd, ressize);
}
}
@@ -520,12 +520,12 @@ static void spawn_read(struct udev_event *event,
pos = buf;
while ((line = strsep(&pos, "\n"))) {
if (pos != NULL || line[0] != '\0')
- log_debug("'%s'(%s) '%s'\n", cmd, *fd == fd_stdout ? "out" : "err" , line);
+ log_debug("'%s'(%s) '%s'", cmd, *fd == fd_stdout ? "out" : "err" , line);
}
}
} else if (ev[i].events & EPOLLHUP) {
if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) {
- log_error("failed to remove fd from epoll: %m\n");
+ log_error("failed to remove fd from epoll: %m");
goto out;
}
*fd = -1;
@@ -570,11 +570,11 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
if (errno == EINTR)
continue;
err = -errno;
- log_error("failed to poll: %m\n");
+ log_error("failed to poll: %m");
goto out;
}
if (fdcount == 0) {
- log_error("timeout: killing '%s' [%u]\n", cmd, pid);
+ log_error("timeout: killing '%s' [%u]", cmd, pid);
kill(pid, SIGKILL);
}
@@ -595,20 +595,20 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
if (waitpid(pid, &status, WNOHANG) < 0)
break;
if (WIFEXITED(status)) {
- log_debug("'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status));
+ log_debug("'%s' [%u] exit with return code %i", cmd, pid, WEXITSTATUS(status));
if (WEXITSTATUS(status) != 0)
err = -1;
} else if (WIFSIGNALED(status)) {
- log_error("'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
+ log_error("'%s' [%u] terminated by signal %i (%s)", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
err = -1;
} else if (WIFSTOPPED(status)) {
- log_error("'%s' [%u] stopped\n", cmd, pid);
+ log_error("'%s' [%u] stopped", cmd, pid);
err = -1;
} else if (WIFCONTINUED(status)) {
- log_error("'%s' [%u] continued\n", cmd, pid);
+ log_error("'%s' [%u] continued", cmd, pid);
err = -1;
} else {
- log_error("'%s' [%u] exit with status 0x%04x\n", cmd, pid, status);
+ log_error("'%s' [%u] exit with status 0x%04x", cmd, pid, status);
err = -1;
}
pid = 0;
@@ -674,14 +674,14 @@ int udev_event_spawn(struct udev_event *event,
if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) {
if (pipe2(outpipe, O_NONBLOCK) != 0) {
err = -errno;
- log_error("pipe failed: %m\n");
+ log_error("pipe failed: %m");
goto out;
}
}
if (udev_get_log_priority(udev) >= LOG_INFO) {
if (pipe2(errpipe, O_NONBLOCK) != 0) {
err = -errno;
- log_error("pipe failed: %m\n");
+ log_error("pipe failed: %m");
goto out;
}
}
@@ -705,14 +705,14 @@ int udev_event_spawn(struct udev_event *event,
errpipe[READ_END] = -1;
}
- log_debug("starting '%s'\n", cmd);
+ log_debug("starting '%s'", cmd);
spawn_exec(event, cmd, argv, envp, sigmask,
outpipe[WRITE_END], errpipe[WRITE_END]);
_exit(2 );
case -1:
- log_error("fork of '%s' failed: %m\n", cmd);
+ log_error("fork of '%s' failed: %m", cmd);
err = -1;
goto out;
default:
@@ -755,7 +755,7 @@ static int rename_netif(struct udev_event *event)
oldname = udev_device_get_sysname(dev);
- log_debug("changing net interface name from '%s' to '%s'\n",
+ log_debug("changing net interface name from '%s' to '%s'",
oldname, event->name);
strscpy(name, IFNAMSIZ, event->name);
@@ -817,7 +817,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
err = rename_netif(event);
if (err == 0) {
- log_debug("renamed netif to '%s'\n", event->name);
+ log_debug("renamed netif to '%s'", event->name);
/* remember old name */
udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev));
@@ -830,7 +830,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
strscpy(pos, sizeof(syspath) - (pos - syspath), event->name);
udev_device_set_syspath(event->dev, syspath);
udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev));
- log_debug("changed devpath to '%s'\n", udev_device_get_devpath(dev));
+ log_debug("changed devpath to '%s'", udev_device_get_devpath(dev));
}
}
}
@@ -900,7 +900,7 @@ void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask)
char **envp;
if (event->exec_delay > 0) {
- log_debug("delay execution of '%s'\n", program);
+ log_debug("delay execution of '%s'", program);
sleep(event->exec_delay);
}
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 0429c35ff7..200e24fb41 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -66,7 +66,7 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
/* preserve link with correct target, do not replace node of other device */
if (lstat(slink, &stats) == 0) {
if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) {
- log_error("conflicting device node '%s' found, link to '%s' will not be created\n", slink, node);
+ log_error("conflicting device node '%s' found, link to '%s' will not be created", slink, node);
goto exit;
} else if (S_ISLNK(stats.st_mode)) {
char buf[UTIL_PATH_SIZE];
@@ -76,7 +76,7 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
if (len > 0 && len < (int)sizeof(buf)) {
buf[len] = '\0';
if (streq(target, buf)) {
- log_debug("preserve already existing symlink '%s' to '%s'\n", slink, target);
+ log_debug("preserve already existing symlink '%s' to '%s'", slink, target);
label_fix(slink, true, false);
utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW);
goto exit;
@@ -84,7 +84,7 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
}
}
} else {
- log_debug("creating symlink '%s' to '%s'\n", slink, target);
+ log_debug("creating symlink '%s' to '%s'", slink, target);
do {
err = mkdir_parents_label(slink, 0755);
if (err != 0 && err != -ENOENT)
@@ -99,7 +99,7 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
goto exit;
}
- log_debug("atomically replace '%s'\n", slink);
+ log_debug("atomically replace '%s'", slink);
strscpyl(slink_tmp, sizeof(slink_tmp), slink, ".tmp-", udev_device_get_id_filename(dev), NULL);
unlink(slink_tmp);
do {
@@ -113,12 +113,12 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
label_context_clear();
} while (err == -ENOENT);
if (err != 0) {
- log_error("symlink '%s' '%s' failed: %m\n", target, slink_tmp);
+ log_error("symlink '%s' '%s' failed: %m", target, slink_tmp);
goto exit;
}
err = rename(slink_tmp, slink);
if (err != 0) {
- log_error("rename '%s' '%s' failed: %m\n", slink_tmp, slink);
+ log_error("rename '%s' '%s' failed: %m", slink_tmp, slink);
unlink(slink_tmp);
}
exit:
@@ -152,7 +152,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons
if (dent->d_name[0] == '.')
continue;
- log_debug("found '%s' claiming '%s'\n", dent->d_name, stackdir);
+ log_debug("found '%s' claiming '%s'", dent->d_name, stackdir);
/* did we find ourself? */
if (streq(dent->d_name, udev_device_get_id_filename(dev)))
@@ -165,7 +165,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons
devnode = udev_device_get_devnode(dev_db);
if (devnode != NULL) {
if (target == NULL || udev_device_get_devlink_priority(dev_db) > priority) {
- log_debug("'%s' claims priority %i for '%s'\n",
+ log_debug("'%s' claims priority %i for '%s'",
udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir);
priority = udev_device_get_devlink_priority(dev_db);
strscpy(buf, bufsize, devnode);
@@ -198,11 +198,11 @@ static void link_update(struct udev_device *dev, const char *slink, bool add)
target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf));
if (target == NULL) {
- log_debug("no reference left, remove '%s'\n", slink);
+ log_debug("no reference left, remove '%s'", slink);
if (unlink(slink) == 0)
util_delete_path(udev, slink);
} else {
- log_debug("creating link '%s' to '%s'\n", slink, target);
+ log_debug("creating link '%s' to '%s'", slink, target);
node_symlink(dev, target, slink);
}
@@ -247,7 +247,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev
if (found)
continue;
- log_debug("update old name, '%s' no longer belonging to '%s'\n",
+ log_debug("update old name, '%s' no longer belonging to '%s'",
name, udev_device_get_devpath(dev));
link_update(dev, name, false);
}
@@ -269,13 +269,13 @@ static int node_permissions_apply(struct udev_device *dev, bool apply,
if (lstat(devnode, &stats) != 0) {
err = -errno;
- log_debug("can not stat() node '%s' (%m)\n", devnode);
+ log_debug("can not stat() node '%s' (%m)", devnode);
goto out;
}
if (((stats.st_mode & S_IFMT) != (mode & S_IFMT)) || (stats.st_rdev != devnum)) {
err = -EEXIST;
- log_debug("found node '%s' with non-matching devnum %s, skip handling\n",
+ log_debug("found node '%s' with non-matching devnum %s, skip handling",
udev_device_get_devnode(dev), udev_device_get_id_filename(dev));
goto out;
}
@@ -285,11 +285,11 @@ static int node_permissions_apply(struct udev_device *dev, bool apply,
bool smack = false;
if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) {
- log_debug("set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid);
+ log_debug("set permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid);
chmod(devnode, mode);
chown(devnode, uid, gid);
} else {
- log_debug("preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid);
+ log_debug("preserve permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid);
}
/* apply SECLABEL{$module}=$label */
@@ -336,7 +336,7 @@ void udev_node_add(struct udev_device *dev, bool apply,
char filename[UTIL_PATH_SIZE];
struct udev_list_entry *list_entry;
- log_debug("handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n",
+ log_debug("handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d",
udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid);
if (node_permissions_apply(dev, apply, mode, uid, gid, seclabel_list) < 0)
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index f793e57712..bbf547222c 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -324,7 +324,7 @@ static void dump_token(struct udev_rules *rules, struct token *token)
const char *tk_ptr = (char *)token;
unsigned int idx = (tk_ptr - tks_ptr) / sizeof(struct token);
- log_debug("* RULE %s:%u, token: %u, count: %u, label: '%s'\n",
+ log_debug("* RULE %s:%u, token: %u, count: %u, label: '%s'",
&rules->buf[token->rule.filename_off], token->rule.filename_line,
idx, token->rule.token_count,
&rules->buf[token->rule.label_off]);
@@ -356,68 +356,68 @@ static void dump_token(struct udev_rules *rules, struct token *token)
case TK_A_MODE:
case TK_A_RUN_BUILTIN:
case TK_A_RUN_PROGRAM:
- log_debug("%s %s '%s'(%s)\n",
+ log_debug("%s %s '%s'(%s)",
token_str(type), operation_str(op), value, string_glob_str(glob));
break;
case TK_M_IMPORT_BUILTIN:
- log_debug("%s %i '%s'\n", token_str(type), token->key.builtin_cmd, value);
+ log_debug("%s %i '%s'", token_str(type), token->key.builtin_cmd, value);
break;
case TK_M_ATTR:
case TK_M_ATTRS:
case TK_M_ENV:
case TK_A_ATTR:
case TK_A_ENV:
- log_debug("%s %s '%s' '%s'(%s)\n",
+ log_debug("%s %s '%s' '%s'(%s)",
token_str(type), operation_str(op), attr, value, string_glob_str(glob));
break;
case TK_M_TAG:
case TK_A_TAG:
- log_debug("%s %s '%s'\n", token_str(type), operation_str(op), value);
+ log_debug("%s %s '%s'", token_str(type), operation_str(op), value);
break;
case TK_A_STRING_ESCAPE_NONE:
case TK_A_STRING_ESCAPE_REPLACE:
case TK_A_DB_PERSIST:
- log_debug("%s\n", token_str(type));
+ log_debug("%s", token_str(type));
break;
case TK_M_TEST:
- log_debug("%s %s '%s'(%s) %#o\n",
+ log_debug("%s %s '%s'(%s) %#o",
token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode);
break;
case TK_A_INOTIFY_WATCH:
- log_debug("%s %u\n", token_str(type), token->key.watch);
+ log_debug("%s %u", token_str(type), token->key.watch);
break;
case TK_A_DEVLINK_PRIO:
- log_debug("%s %u\n", token_str(type), token->key.devlink_prio);
+ log_debug("%s %u", token_str(type), token->key.devlink_prio);
break;
case TK_A_OWNER_ID:
- log_debug("%s %s %u\n", token_str(type), operation_str(op), token->key.uid);
+ log_debug("%s %s %u", token_str(type), operation_str(op), token->key.uid);
break;
case TK_A_GROUP_ID:
- log_debug("%s %s %u\n", token_str(type), operation_str(op), token->key.gid);
+ log_debug("%s %s %u", token_str(type), operation_str(op), token->key.gid);
break;
case TK_A_MODE_ID:
- log_debug("%s %s %#o\n", token_str(type), operation_str(op), token->key.mode);
+ log_debug("%s %s %#o", token_str(type), operation_str(op), token->key.mode);
break;
case TK_A_STATIC_NODE:
- log_debug("%s '%s'\n", token_str(type), value);
+ log_debug("%s '%s'", token_str(type), value);
break;
case TK_A_SECLABEL:
- log_debug("%s %s '%s' '%s'\n", token_str(type), operation_str(op), attr, value);
+ log_debug("%s %s '%s' '%s'", token_str(type), operation_str(op), attr, value);
break;
case TK_M_EVENT_TIMEOUT:
- log_debug("%s %u\n", token_str(type), token->key.event_timeout);
+ log_debug("%s %u", token_str(type), token->key.event_timeout);
break;
case TK_A_GOTO:
- log_debug("%s '%s' %u\n", token_str(type), value, token->key.rule_goto);
+ log_debug("%s '%s' %u", token_str(type), value, token->key.rule_goto);
break;
case TK_END:
- log_debug("* %s\n", token_str(type));
+ log_debug("* %s", token_str(type));
break;
case TK_M_PARENTS_MIN:
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_UNSET:
- log_debug("unknown type %u\n", type);
+ log_debug("unknown type %u", type);
break;
}
}
@@ -426,7 +426,7 @@ static void dump_rules(struct udev_rules *rules)
{
unsigned int i;
- log_debug("dumping %u (%zu bytes) tokens, %u (%zu bytes) strings\n",
+ log_debug("dumping %u (%zu bytes) tokens, %u (%zu bytes) strings",
rules->token_cur,
rules->token_cur * sizeof(struct token),
rules->buf_count,
@@ -595,7 +595,7 @@ static int import_property_from_string(struct udev_device *dev, char *line)
/* unquote */
if (val[0] == '"' || val[0] == '\'') {
if (val[len-1] != val[0]) {
- log_debug("inconsistent quoting: '%s', skip\n", line);
+ log_debug("inconsistent quoting: '%s', skip", line);
return -1;
}
val[len-1] = '\0';
@@ -698,18 +698,18 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout)
/* lookup file */
if (stat(file, &stats) == 0) {
- log_debug("file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1);
+ log_debug("file '%s' appeared after %i loops", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1);
return 0;
}
/* make sure, the device did not disappear in the meantime */
if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) {
- log_debug("device disappeared while waiting for '%s'\n", file);
+ log_debug("device disappeared while waiting for '%s'", file);
return -2;
}
- log_debug("wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND);
+ log_debug("wait for '%s' for %i mseconds", file, 1000 / WAIT_LOOP_PER_SECOND);
nanosleep(&duration, NULL);
}
- log_debug("waiting for '%s' failed\n", file);
+ log_debug("waiting for '%s' failed", file);
return -1;
}
@@ -849,7 +849,7 @@ static const char *get_key_attribute(struct udev *udev, char *str)
attr++;
pos = strchr(attr, '}');
if (pos == NULL) {
- log_error("missing closing brace for format\n");
+ log_error("missing closing brace for format");
return NULL;
}
pos[0] = '\0';
@@ -950,7 +950,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
case TK_M_MAX:
case TK_END:
case TK_UNSET:
- log_error("wrong type %u\n", type);
+ log_error("wrong type %u", type);
return -1;
}
@@ -1001,7 +1001,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
token->key.op = op;
rule_tmp->token_cur++;
if (rule_tmp->token_cur >= ELEMENTSOF(rule_tmp->token)) {
- log_error("temporary rule array too small\n");
+ log_error("temporary rule array too small");
return -1;
}
return 0;
@@ -1088,7 +1088,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "ACTION")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid ACTION operation\n");
+ log_error("invalid ACTION operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_ACTION, op, value, NULL);
@@ -1097,7 +1097,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "DEVPATH")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid DEVPATH operation\n");
+ log_error("invalid DEVPATH operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_DEVPATH, op, value, NULL);
@@ -1106,7 +1106,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "KERNEL")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid KERNEL operation\n");
+ log_error("invalid KERNEL operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_KERNEL, op, value, NULL);
@@ -1115,7 +1115,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "SUBSYSTEM")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid SUBSYSTEM operation\n");
+ log_error("invalid SUBSYSTEM operation");
goto invalid;
}
/* bus, class, subsystem events should all be the same */
@@ -1123,7 +1123,7 @@ static int add_rule(struct udev_rules *rules, char *line,
streq(value, "bus") ||
streq(value, "class")) {
if (streq(value, "bus") || streq(value, "class"))
- log_error("'%s' must be specified as 'subsystem' \n"
+ log_error("'%s' must be specified as 'subsystem' "
"please fix it in %s:%u", value, filename, lineno);
rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL);
} else
@@ -1133,7 +1133,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "DRIVER")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid DRIVER operation\n");
+ log_error("invalid DRIVER operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_DRIVER, op, value, NULL);
@@ -1143,7 +1143,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (startswith(key, "ATTR{")) {
attr = get_key_attribute(rules->udev, key + sizeof("ATTR")-1);
if (attr == NULL) {
- log_error("error parsing ATTR attribute\n");
+ log_error("error parsing ATTR attribute");
goto invalid;
}
if (op < OP_MATCH_MAX) {
@@ -1157,7 +1157,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (startswith(key, "SECLABEL{")) {
attr = get_key_attribute(rules->udev, key + sizeof("SECLABEL")-1);
if (!attr) {
- log_error("error parsing SECLABEL attribute\n");
+ log_error("error parsing SECLABEL attribute");
goto invalid;
}
@@ -1167,7 +1167,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "KERNELS")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid KERNELS operation\n");
+ log_error("invalid KERNELS operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL);
@@ -1176,7 +1176,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "SUBSYSTEMS")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid SUBSYSTEMS operation\n");
+ log_error("invalid SUBSYSTEMS operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL);
@@ -1185,7 +1185,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "DRIVERS")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid DRIVERS operation\n");
+ log_error("invalid DRIVERS operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_DRIVERS, op, value, NULL);
@@ -1194,12 +1194,12 @@ static int add_rule(struct udev_rules *rules, char *line,
if (startswith(key, "ATTRS{")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid ATTRS operation\n");
+ log_error("invalid ATTRS operation");
goto invalid;
}
attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1);
if (attr == NULL) {
- log_error("error parsing ATTRS attribute\n");
+ log_error("error parsing ATTRS attribute");
goto invalid;
}
if (startswith(attr, "device/"))
@@ -1214,7 +1214,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "TAGS")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid TAGS operation\n");
+ log_error("invalid TAGS operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_TAGS, op, value, NULL);
@@ -1224,7 +1224,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (startswith(key, "ENV{")) {
attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1);
if (attr == NULL) {
- log_error("error parsing ENV attribute\n");
+ log_error("error parsing ENV attribute");
goto invalid;
}
if (op < OP_MATCH_MAX) {
@@ -1249,7 +1249,7 @@ static int add_rule(struct udev_rules *rules, char *line,
for (i = 0; i < ELEMENTSOF(blacklist); i++) {
if (!streq(attr, blacklist[i]))
continue;
- log_error("invalid ENV attribute, '%s' can not be set %s:%u\n", attr, filename, lineno);
+ log_error("invalid ENV attribute, '%s' can not be set %s:%u", attr, filename, lineno);
goto invalid;
}
if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0)
@@ -1273,7 +1273,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (streq(key, "RESULT")) {
if (op > OP_MATCH_MAX) {
- log_error("invalid RESULT operation\n");
+ log_error("invalid RESULT operation");
goto invalid;
}
rule_add_key(&rule_tmp, TK_M_RESULT, op, value, NULL);
@@ -1283,7 +1283,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (startswith(key, "IMPORT")) {
attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1);
if (attr == NULL) {
- log_error("IMPORT{} type missing, ignoring IMPORT %s:%u\n", filename, lineno);
+ log_error("IMPORT{} type missing, ignoring IMPORT %s:%u", filename, lineno);
continue;
}
if (streq(attr, "program")) {
@@ -1293,7 +1293,7 @@ static int add_rule(struct udev_rules *rules, char *line,
cmd = udev_builtin_lookup(value);
if (cmd < UDEV_BUILTIN_MAX) {
- log_debug("IMPORT found builtin '%s', replacing %s:%u\n",
+ log_debug("IMPORT found builtin '%s', replacing %s:%u",
value, filename, lineno);
rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd);
continue;
@@ -1306,7 +1306,7 @@ static int add_rule(struct udev_rules *rules, char *line,
if (cmd < UDEV_BUILTIN_MAX)
rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd);
else
- log_error("IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno);
+ log_error("IMPORT{builtin}: '%s' unknown %s:%u", value, filename, lineno);
} else if (streq(attr, "file")) {
rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL);
} else if (streq(attr, "db")) {
@@ -1316,7 +1316,7 @@ static int add_rule(struct udev_rules *rules, char *line,
} else if (streq(attr, "parent")) {
rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL);
} else
- log_error("IMPORT{} unknown type, ignoring IMPORT %s:%u\n", filename, lineno);
+ log_error("IMPORT{} unknown type, ignoring IMPORT %s:%u", filename, lineno);
continue;
}
@@ -1324,7 +1324,7 @@ static int add_rule(struct udev_rules *rules, char *line,
mode_t mode = 0;
if (op > OP_MATCH_MAX) {
- log_error("invalid TEST operation\n");
+ log_error("invalid TEST operation");
goto invalid;
}
attr = get_key_attribute(rules->udev, key + sizeof("TEST")-1);
@@ -1348,13 +1348,13 @@ static int add_rule(struct udev_rules *rules, char *line,
if (cmd < UDEV_BUILTIN_MAX)
rule_add_key(&rule_tmp, TK_A_RUN_BUILTIN, op, value, &cmd);
else
- log_error("IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno);
+ log_error("IMPORT{builtin}: '%s' unknown %s:%u", value, filename, lineno);
} else if (streq(attr, "program")) {
enum udev_builtin_cmd cmd = UDEV_BUILTIN_MAX;
rule_add_key(&rule_tmp, TK_A_RUN_PROGRAM, op, value, &cmd);
} else {
- log_error("RUN{} unknown type, ignoring RUN %s:%u\n", filename, lineno);
+ log_error("RUN{} unknown type, ignoring RUN %s:%u", filename, lineno);
}
continue;
@@ -1504,7 +1504,7 @@ static int add_rule(struct udev_rules *rules, char *line,
continue;
}
- log_error("unknown key '%s' in %s:%u\n", key, filename, lineno);
+ log_error("unknown key '%s' in %s:%u", key, filename, lineno);
goto invalid;
}
@@ -1519,7 +1519,7 @@ static int add_rule(struct udev_rules *rules, char *line,
return 0;
invalid:
- log_error("invalid rule '%s:%u'\n", filename, lineno);
+ log_error("invalid rule '%s:%u'", filename, lineno);
return -1;
}
@@ -1533,10 +1533,10 @@ static int parse_file(struct udev_rules *rules, const char *filename)
unsigned int i;
if (null_or_empty_path(filename)) {
- log_debug("skip empty file: %s\n", filename);
+ log_debug("skip empty file: %s", filename);
return 0;
}
- log_debug("read rules file: %s\n", filename);
+ log_debug("read rules file: %s", filename);
f = fopen(filename, "re");
if (f == NULL)
@@ -1574,7 +1574,7 @@ static int parse_file(struct udev_rules *rules, const char *filename)
}
if (len+1 >= sizeof(line)) {
- log_error("line too long '%s':%u, ignored\n", filename, line_nr);
+ log_error("line too long '%s':%u, ignored", filename, line_nr);
continue;
}
add_rule(rules, key, filename, filename_off, line_nr);
@@ -1598,7 +1598,7 @@ static int parse_file(struct udev_rules *rules, const char *filename)
break;
}
if (rules->tokens[i].key.rule_goto == 0)
- log_error("GOTO '%s' has no matching label in: '%s'\n", label, filename);
+ log_error("GOTO '%s' has no matching label in: '%s'", label, filename);
}
}
return 0;
@@ -1638,7 +1638,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
return udev_rules_unref(rules);
}
if (!path_strv_canonicalize(rules->dirs)) {
- log_error("failed to canonicalize config directories\n");
+ log_error("failed to canonicalize config directories");
return udev_rules_unref(rules);
}
strv_uniq(rules->dirs);
@@ -1647,7 +1647,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
r = conf_files_list_strv(&files, ".rules", NULL, (const char **)rules->dirs);
if (r < 0) {
- log_error("failed to enumerate rules files: %s\n", strerror(-r));
+ log_error("failed to enumerate rules files: %s", strerror(-r));
return udev_rules_unref(rules);
}
@@ -1666,11 +1666,11 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
memset(&end_token, 0x00, sizeof(struct token));
end_token.type = TK_END;
add_token(rules, &end_token);
- log_debug("rules contain %zu bytes tokens (%u * %zu bytes), %zu bytes strings\n",
+ log_debug("rules contain %zu bytes tokens (%u * %zu bytes), %zu bytes strings",
rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->strbuf->len);
/* cleanup temporary strbuf data */
- log_debug("%zu strings (%zu bytes), %zu de-duplicated (%zu bytes), %zu trie nodes used\n",
+ log_debug("%zu strings (%zu bytes), %zu de-duplicated (%zu bytes), %zu trie nodes used",
rules->strbuf->in_count, rules->strbuf->in_len,
rules->strbuf->dedup_count, rules->strbuf->dedup_len, rules->strbuf->nodes_count);
strbuf_complete(rules->strbuf);
@@ -2035,7 +2035,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
break;
}
case TK_M_EVENT_TIMEOUT:
- log_debug("OPTIONS event_timeout=%u\n", cur->key.event_timeout);
+ log_debug("OPTIONS event_timeout=%u", cur->key.event_timeout);
event->timeout_usec = cur->key.event_timeout * 1000 * 1000;
break;
case TK_M_PROGRAM: {
@@ -2047,7 +2047,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
event->program_result = NULL;
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), program, sizeof(program));
envp = udev_device_get_properties_envp(event->dev);
- log_debug("PROGRAM '%s' %s:%u\n",
+ log_debug("PROGRAM '%s' %s:%u",
program,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2062,7 +2062,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) {
count = util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT);
if (count > 0)
- log_debug("%i character(s) replaced\n" , count);
+ log_debug("%i character(s) replaced" , count);
}
event->program_result = strdup(result);
if (cur->key.op == OP_NOMATCH)
@@ -2083,7 +2083,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
char import[UTIL_PATH_SIZE];
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), import, sizeof(import));
- log_debug("IMPORT '%s' %s:%u\n",
+ log_debug("IMPORT '%s' %s:%u",
import,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2099,7 +2099,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
if (udev_builtin_run_once(cur->key.builtin_cmd)) {
/* check if we ran already */
if (event->builtin_run & (1 << cur->key.builtin_cmd)) {
- log_debug("IMPORT builtin skip '%s' %s:%u\n",
+ log_debug("IMPORT builtin skip '%s' %s:%u",
udev_builtin_name(cur->key.builtin_cmd),
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2114,14 +2114,14 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
}
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), command, sizeof(command));
- log_debug("IMPORT builtin '%s' %s:%u\n",
+ log_debug("IMPORT builtin '%s' %s:%u",
udev_builtin_name(cur->key.builtin_cmd),
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
if (udev_builtin_run(event->dev, cur->key.builtin_cmd, command, false) != 0) {
/* remember failure */
- log_debug("IMPORT builtin '%s' returned non-zero\n",
+ log_debug("IMPORT builtin '%s' returned non-zero",
udev_builtin_name(cur->key.builtin_cmd));
event->builtin_ret |= (1 << cur->key.builtin_cmd);
if (cur->key.op != OP_NOMATCH)
@@ -2229,7 +2229,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), owner, sizeof(owner));
event->owner_set = true;
event->uid = util_lookup_user(event->udev, owner);
- log_debug("OWNER %u %s:%u\n",
+ log_debug("OWNER %u %s:%u",
event->uid,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2245,7 +2245,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), group, sizeof(group));
event->group_set = true;
event->gid = util_lookup_group(event->udev, group);
- log_debug("GROUP %u %s:%u\n",
+ log_debug("GROUP %u %s:%u",
event->gid,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2261,14 +2261,14 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), mode_str, sizeof(mode_str));
mode = strtol(mode_str, &endptr, 8);
if (endptr[0] != '\0') {
- log_error("ignoring invalid mode '%s'\n", mode_str);
+ log_error("ignoring invalid mode '%s'", mode_str);
break;
}
if (cur->key.op == OP_ASSIGN_FINAL)
event->mode_final = true;
event->mode_set = true;
event->mode = mode;
- log_debug("MODE %#o %s:%u\n",
+ log_debug("MODE %#o %s:%u",
event->mode,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2281,7 +2281,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
event->owner_final = true;
event->owner_set = true;
event->uid = cur->key.uid;
- log_debug("OWNER %u %s:%u\n",
+ log_debug("OWNER %u %s:%u",
event->uid,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2293,7 +2293,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
event->group_final = true;
event->group_set = true;
event->gid = cur->key.gid;
- log_debug("GROUP %u %s:%u\n",
+ log_debug("GROUP %u %s:%u",
event->gid,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2305,7 +2305,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
event->mode_final = true;
event->mode_set = true;
event->mode = cur->key.mode;
- log_debug("MODE %#o %s:%u\n",
+ log_debug("MODE %#o %s:%u",
event->mode,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2318,7 +2318,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL)
udev_list_cleanup(&event->seclabel_list);
udev_list_entry_add(&event->seclabel_list, name, label);
- log_debug("SECLABEL{%s}='%s' %s:%u\n",
+ log_debug("SECLABEL{%s}='%s' %s:%u",
name, label,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2368,7 +2368,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
(*p >= '0' && *p <= '9') ||
*p == '-' || *p == '_')
continue;
- log_error("ignoring invalid tag name '%s'\n", tag);
+ log_error("ignoring invalid tag name '%s'", tag);
break;
}
udev_device_add_tag(event->dev, tag);
@@ -2388,7 +2388,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) {
count = util_replace_chars(name_str, "/");
if (count > 0)
- log_debug("%i character(s) replaced\n", count);
+ log_debug("%i character(s) replaced", count);
}
if (major(udev_device_get_devnum(event->dev)) &&
(!streq(name_str, udev_device_get_devnode(event->dev) + strlen("/dev/")))) {
@@ -2399,7 +2399,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
}
free(event->name);
event->name = strdup(name_str);
- log_debug("NAME '%s' %s:%u\n",
+ log_debug("NAME '%s' %s:%u",
event->name,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2427,14 +2427,14 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
else if (esc == ESCAPE_REPLACE)
count = util_replace_chars(temp, "/");
if (count > 0)
- log_debug("%i character(s) replaced\n" , count);
+ log_debug("%i character(s) replaced" , count);
pos = temp;
while (isspace(pos[0]))
pos++;
next = strchr(pos, ' ');
while (next != NULL) {
next[0] = '\0';
- log_debug("LINK '%s' %s:%u\n", pos,
+ log_debug("LINK '%s' %s:%u", pos,
rules_str(rules, rule->rule.filename_off), rule->rule.filename_line);
strscpyl(filename, sizeof(filename), "/dev/", pos, NULL);
udev_device_add_devlink(event->dev, filename);
@@ -2444,7 +2444,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
next = strchr(pos, ' ');
}
if (pos[0] != '\0') {
- log_debug("LINK '%s' %s:%u\n", pos,
+ log_debug("LINK '%s' %s:%u", pos,
rules_str(rules, rule->rule.filename_off), rule->rule.filename_line);
strscpyl(filename, sizeof(filename), "/dev/", pos, NULL);
udev_device_add_devlink(event->dev, filename);
@@ -2462,16 +2462,16 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
attr_subst_subdir(attr, sizeof(attr));
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), value, sizeof(value));
- log_debug("ATTR '%s' writing '%s' %s:%u\n", attr, value,
+ log_debug("ATTR '%s' writing '%s' %s:%u", attr, value,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
f = fopen(attr, "we");
if (f != NULL) {
if (fprintf(f, "%s", value) <= 0)
- log_error("error writing ATTR{%s}: %m\n", attr);
+ log_error("error writing ATTR{%s}: %m", attr);
fclose(f);
} else {
- log_error("error opening ATTR{%s} for writing: %m\n", attr);
+ log_error("error opening ATTR{%s} for writing: %m", attr);
}
break;
}
@@ -2481,7 +2481,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL)
udev_list_cleanup(&event->run_list);
- log_debug("RUN '%s' %s:%u\n",
+ log_debug("RUN '%s' %s:%u",
rules_str(rules, cur->key.value_off),
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
@@ -2501,7 +2501,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_UNSET:
- log_error("wrong type %u\n", cur->type);
+ log_error("wrong type %u", cur->type);
goto nomatch;
}
@@ -2586,7 +2586,7 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules)
strscpyl(tags_dir, sizeof(tags_dir), "/run/udev/static_node-tags/", *t, "/", NULL);
r = mkdir_p(tags_dir, 0755);
if (r < 0) {
- log_error("failed to create %s: %s\n", tags_dir, strerror(-r));
+ log_error("failed to create %s: %s", tags_dir, strerror(-r));
return r;
}
@@ -2595,7 +2595,7 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules)
strscpyl(tag_symlink, sizeof(tag_symlink), tags_dir, unescaped_filename, NULL);
r = symlink(device_node, tag_symlink);
if (r < 0 && errno != EEXIST) {
- log_error("failed to create symlink %s -> %s: %m\n", tag_symlink, device_node);
+ log_error("failed to create symlink %s -> %s: %m", tag_symlink, device_node);
return -errno;
} else
r = 0;
@@ -2615,19 +2615,19 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules)
if (mode != (stats.st_mode & 01777)) {
r = chmod(device_node, mode);
if (r < 0) {
- log_error("failed to chmod '%s' %#o\n", device_node, mode);
+ log_error("failed to chmod '%s' %#o", device_node, mode);
return -errno;
} else
- log_debug("chmod '%s' %#o\n", device_node, mode);
+ log_debug("chmod '%s' %#o", device_node, mode);
}
if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) {
r = chown(device_node, uid, gid);
if (r < 0) {
- log_error("failed to chown '%s' %u %u \n", device_node, uid, gid);
+ log_error("failed to chown '%s' %u %u ", device_node, uid, gid);
return -errno;
} else
- log_debug("chown '%s' %u %u\n", device_node, uid, gid);
+ log_debug("chown '%s' %u %u", device_node, uid, gid);
}
utimensat(AT_FDCWD, device_node, NULL, 0);
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c
index 9b694c6666..cbe0c37a4f 100644
--- a/src/udev/udev-watch.c
+++ b/src/udev/udev-watch.c
@@ -40,7 +40,7 @@ int udev_watch_init(struct udev *udev)
{
inotify_fd = inotify_init1(IN_CLOEXEC);
if (inotify_fd < 0)
- log_error("inotify_init failed: %m\n");
+ log_error("inotify_init failed: %m");
return inotify_fd;
}
@@ -79,7 +79,7 @@ void udev_watch_restore(struct udev *udev)
if (dev == NULL)
goto unlink;
- log_debug("restoring old watch on '%s'\n", udev_device_get_devnode(dev));
+ log_debug("restoring old watch on '%s'", udev_device_get_devnode(dev));
udev_watch_begin(udev, dev);
udev_device_unref(dev);
unlink:
@@ -103,10 +103,10 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
if (inotify_fd < 0)
return;
- log_debug("adding watch on '%s'\n", udev_device_get_devnode(dev));
+ log_debug("adding watch on '%s'", udev_device_get_devnode(dev));
wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
if (wd < 0) {
- log_error("inotify_add_watch(%d, %s, %o) failed: %m\n",
+ log_error("inotify_add_watch(%d, %s, %o) failed: %m",
inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
return;
}
@@ -133,7 +133,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev)
if (wd < 0)
return;
- log_debug("removing watch on '%s'\n", udev_device_get_devnode(dev));
+ log_debug("removing watch on '%s'", udev_device_get_devnode(dev));
inotify_rm_watch(inotify_fd, wd);
snprintf(filename, sizeof(filename), "/run/udev/watch/%d", wd);
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index 61a3b08199..1f7f0c7290 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -389,17 +389,17 @@ static int trie_store(struct trie *trie, const char *filename) {
goto out;
}
- log_debug("=== trie on-disk ===\n");
- log_debug("size: %8llu bytes\n", (unsigned long long)size);
- log_debug("header: %8zu bytes\n", sizeof(struct trie_header_f));
- log_debug("nodes: %8llu bytes (%8llu)\n",
+ log_debug("=== trie on-disk ===");
+ log_debug("size: %8llu bytes", (unsigned long long)size);
+ log_debug("header: %8zu bytes", sizeof(struct trie_header_f));
+ log_debug("nodes: %8llu bytes (%8llu)",
(unsigned long long)t.nodes_count * sizeof(struct trie_node_f), (unsigned long long)t.nodes_count);
- log_debug("child pointers: %8llu bytes (%8llu)\n",
+ log_debug("child pointers: %8llu bytes (%8llu)",
(unsigned long long)t.children_count * sizeof(struct trie_child_entry_f), (unsigned long long)t.children_count);
- log_debug("value pointers: %8llu bytes (%8llu)\n",
+ log_debug("value pointers: %8llu bytes (%8llu)",
(unsigned long long)t.values_count * sizeof(struct trie_value_entry_f), (unsigned long long)t.values_count);
- log_debug("string store: %8llu bytes\n", (unsigned long long)trie->strings->len);
- log_debug("strings start: %8llu\n", (unsigned long long) t.strings_off);
+ log_debug("string store: %8llu bytes", (unsigned long long)trie->strings->len);
+ log_debug("strings start: %8llu", (unsigned long long) t.strings_off);
out:
free(filename_tmp);
return err;
@@ -412,7 +412,7 @@ static int insert_data(struct trie *trie, struct udev_list *match_list,
value = strchr(line, '=');
if (!value) {
- log_error("Error, key/value pair expected but got '%s' in '%s':\n", line, filename);
+ log_error("Error, key/value pair expected but got '%s' in '%s':", line, filename);
return -EINVAL;
}
@@ -420,7 +420,7 @@ static int insert_data(struct trie *trie, struct udev_list *match_list,
value++;
if (line[0] == '\0' || value[0] == '\0') {
- log_error("Error, empty key or value '%s' in '%s':\n", line, filename);
+ log_error("Error, empty key or value '%s' in '%s':", line, filename);
return -EINVAL;
}
@@ -471,7 +471,7 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
break;
if (line[0] == ' ') {
- log_error("Error, MATCH expected but got '%s' in '%s':\n", line, filename);
+ log_error("Error, MATCH expected but got '%s' in '%s':", line, filename);
break;
}
@@ -482,7 +482,7 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
case HW_MATCH:
if (len == 0) {
- log_error("Error, DATA expected but got empty line in '%s':\n", filename);
+ log_error("Error, DATA expected but got empty line in '%s':", filename);
state = HW_NONE;
udev_list_cleanup(&match_list);
break;
@@ -508,7 +508,7 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
}
if (line[0] != ' ') {
- log_error("Error, DATA expected but got '%s' in '%s':\n", line, filename);
+ log_error("Error, DATA expected but got '%s' in '%s':", line, filename);
state = HW_NONE;
udev_list_cleanup(&match_list);
break;
@@ -599,7 +599,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
err = conf_files_list_strv(&files, ".hwdb", root, conf_file_dirs);
if (err < 0) {
- log_error("failed to enumerate hwdb files: %s\n", strerror(-err));
+ log_error("failed to enumerate hwdb files: %s", strerror(-err));
rc = EXIT_FAILURE;
goto out;
}
@@ -611,18 +611,18 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
strbuf_complete(trie->strings);
- log_debug("=== trie in-memory ===\n");
- log_debug("nodes: %8zu bytes (%8zu)\n",
+ log_debug("=== trie in-memory ===");
+ log_debug("nodes: %8zu bytes (%8zu)",
trie->nodes_count * sizeof(struct trie_node), trie->nodes_count);
- log_debug("children arrays: %8zu bytes (%8zu)\n",
+ log_debug("children arrays: %8zu bytes (%8zu)",
trie->children_count * sizeof(struct trie_child_entry), trie->children_count);
- log_debug("values arrays: %8zu bytes (%8zu)\n",
+ log_debug("values arrays: %8zu bytes (%8zu)",
trie->values_count * sizeof(struct trie_value_entry), trie->values_count);
- log_debug("strings: %8zu bytes\n",
+ log_debug("strings: %8zu bytes",
trie->strings->len);
- log_debug("strings incoming: %8zu bytes (%8zu)\n",
+ log_debug("strings incoming: %8zu bytes (%8zu)",
trie->strings->in_len, trie->strings->in_count);
- log_debug("strings dedup'ed: %8zu bytes (%8zu)\n",
+ log_debug("strings dedup'ed: %8zu bytes (%8zu)",
trie->strings->dedup_len, trie->strings->dedup_count);
if (asprintf(&hwdb_bin, "%s/etc/udev/hwdb.bin", root) < 0) {
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index 94e76da6fd..6022e8db82 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -158,7 +158,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[])
fd_ep = epoll_create1(EPOLL_CLOEXEC);
if (fd_ep < 0) {
- log_error("error creating epoll fd: %m\n");
+ log_error("error creating epoll fd: %m");
return 1;
}
@@ -198,7 +198,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[])
ep_udev.events = EPOLLIN;
ep_udev.data.fd = fd_udev;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) {
- log_error("fail to add fd to epoll: %m\n");
+ log_error("fail to add fd to epoll: %m");
return 2;
}
@@ -232,7 +232,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[])
ep_kernel.events = EPOLLIN;
ep_kernel.data.fd = fd_kernel;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) {
- log_error("fail to add fd to epoll: %m\n");
+ log_error("fail to add fd to epoll: %m");
return 5;
}
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index 5da0be50d7..b026155660 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -122,20 +122,20 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
end = udev_queue_get_kernel_seqnum(udev_queue);
if (start > end) {
- log_error("seq-start larger than seq-end, ignoring\n");
+ log_error("seq-start larger than seq-end, ignoring");
start = 0;
end = 0;
}
if (start > kernel_seq || end > kernel_seq) {
- log_error("seq-start or seq-end larger than current kernel value, ignoring\n");
+ log_error("seq-start or seq-end larger than current kernel value, ignoring");
start = 0;
end = 0;
}
- log_debug("start=%llu end=%llu current=%llu\n", (unsigned long long)start, (unsigned long long)end, kernel_seq);
+ log_debug("start=%llu end=%llu current=%llu", (unsigned long long)start, (unsigned long long)end, kernel_seq);
} else {
if (end > 0) {
- log_error("seq-end needs seq-start parameter, ignoring\n");
+ log_error("seq-end needs seq-start parameter, ignoring");
end = 0;
}
}
@@ -147,7 +147,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
uctrl = udev_ctrl_new(udev);
if (uctrl != NULL) {
if (udev_ctrl_send_ping(uctrl, timeout) < 0) {
- log_debug("no connection to daemon\n");
+ log_debug("no connection to daemon");
udev_ctrl_unref(uctrl);
rc = EXIT_SUCCESS;
goto out;
@@ -159,10 +159,10 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
pfd[0].events = POLLIN;
pfd[0].fd = inotify_init1(IN_CLOEXEC);
if (pfd[0].fd < 0) {
- log_error("inotify_init failed: %m\n");
+ log_error("inotify_init failed: %m");
} else {
if (inotify_add_watch(pfd[0].fd, "/run/udev" , IN_MOVED_TO) < 0) {
- log_error("watching /run/udev failed\n");
+ log_error("watching /run/udev failed");
close(pfd[0].fd);
pfd[0].fd = -1;
}
@@ -215,7 +215,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
struct udev_list_entry *list_entry;
if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) {
- log_debug("timeout waiting for udev queue\n");
+ log_debug("timeout waiting for udev queue");
printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout);
udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue))
printf(" %s (%s)\n",
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index a9f9cafc0b..6cd311b27d 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -53,7 +53,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[])
{}
};
- log_debug("version %s\n", VERSION);
+ log_debug("version %s", VERSION);
while((c = getopt_long(argc, argv, "a:N:h", options, NULL)) >= 0)
switch (c) {
@@ -69,7 +69,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[])
resolve_names = -1;
} else {
fprintf(stderr, "resolve-names must be early, late or never\n");
- log_error("resolve-names must be early, late or never\n");
+ log_error("resolve-names must be early, late or never");
exit(EXIT_FAILURE);
}
break;
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index a898ef99e4..087ee4bfae 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -55,7 +55,7 @@ static void exec_list(struct udev_enumerate *udev_enumerate, const char *action)
if (fd < 0)
continue;
if (write(fd, action, strlen(action)) < 0)
- log_debug("error writing '%s' to '%s': %m\n", action, filename);
+ log_debug("error writing '%s' to '%s': %m", action, filename);
close(fd);
}
}
@@ -141,13 +141,13 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
else if (streq(optarg, "subsystems"))
device_type = TYPE_SUBSYSTEMS;
else {
- log_error("unknown type --type=%s\n", optarg);
+ log_error("unknown type --type=%s", optarg);
return 2;
}
break;
case 'c':
if (!nulstr_contains("add\0" "remove\0" "change\0", optarg)) {
- log_error("unknown action '%s'\n", optarg);
+ log_error("unknown action '%s'", optarg);
return 2;
} else
action = optarg;
@@ -189,7 +189,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
util_remove_trailing_chars(path, '/');
dev = udev_device_new_from_syspath(udev, path);
if (dev == NULL) {
- log_error("unable to open the device '%s'\n", optarg);
+ log_error("unable to open the device '%s'", optarg);
return 2;
}
udev_enumerate_add_match_parent(udev_enumerate, dev);
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index e14b3ca27c..dbca369011 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -79,7 +79,7 @@ static int run_command(struct udev *udev, const struct udevadm_cmd *cmd, int arg
{
if (cmd->debug)
log_set_max_level(LOG_DEBUG);
- log_debug("calling: %s\n", cmd->name);
+ log_debug("calling: %s", cmd->name);
return cmd->cmd(udev, argc, argv);
}
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 572bca881d..d7c172cc75 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -145,7 +145,7 @@ static void event_queue_delete(struct event *event, bool export)
if (export) {
udev_queue_export_device_finished(udev_queue_export, event->dev);
- log_debug("seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode);
+ log_debug("seq %llu done with %i", udev_device_get_seqnum(event->dev), event->exitcode);
}
udev_device_unref(event->dev);
free(event);
@@ -170,7 +170,7 @@ static void worker_unref(struct worker *worker)
worker->refcount--;
if (worker->refcount > 0)
return;
- log_debug("worker [%u] cleaned up\n", worker->pid);
+ log_debug("worker [%u] cleaned up", worker->pid);
worker_cleanup(worker);
}
@@ -235,14 +235,14 @@ static void worker_new(struct event *event)
sigfillset(&mask);
fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
if (fd_signal < 0) {
- log_error("error creating signalfd %m\n");
+ log_error("error creating signalfd %m");
rc = 2;
goto out;
}
fd_ep = epoll_create1(EPOLL_CLOEXEC);
if (fd_ep < 0) {
- log_error("error creating epoll fd: %m\n");
+ log_error("error creating epoll fd: %m");
rc = 3;
goto out;
}
@@ -258,7 +258,7 @@ static void worker_new(struct event *event)
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 ||
epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_monitor, &ep_monitor) < 0) {
- log_error("fail to add fds to epoll: %m\n");
+ log_error("fail to add fds to epoll: %m");
rc = 4;
goto out;
}
@@ -274,7 +274,7 @@ static void worker_new(struct event *event)
struct worker_message msg;
int err;
- log_debug("seq %llu running\n", udev_device_get_seqnum(dev));
+ log_debug("seq %llu running", udev_device_get_seqnum(dev));
udev_event = udev_event_new(dev);
if (udev_event == NULL) {
rc = 5;
@@ -309,7 +309,7 @@ static void worker_new(struct event *event)
msg.pid = getpid();
send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0);
- log_debug("seq %llu processed with %i\n", udev_device_get_seqnum(dev), err);
+ log_debug("seq %llu processed with %i", udev_device_get_seqnum(dev), err);
udev_device_unref(dev);
dev = NULL;
@@ -331,7 +331,7 @@ static void worker_new(struct event *event)
if (fdcount < 0) {
if (errno == EINTR)
continue;
- log_error("failed to poll: %m\n");
+ log_error("failed to poll: %m");
goto out;
}
@@ -373,7 +373,7 @@ out:
udev_monitor_unref(worker_monitor);
event->state = EVENT_QUEUED;
free(worker);
- log_error("fork of child failed: %m\n");
+ log_error("fork of child failed: %m");
break;
default:
/* close monitor, but keep address around */
@@ -386,7 +386,7 @@ out:
event->state = EVENT_RUNNING;
udev_list_node_append(&worker->node, &worker_list);
children++;
- log_debug("seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid);
+ log_debug("seq %llu forked new worker [%u]", udev_device_get_seqnum(event->dev), pid);
break;
}
}
@@ -404,7 +404,7 @@ static void event_run(struct event *event)
count = udev_monitor_send_device(monitor, worker->monitor, event->dev);
if (count < 0) {
- log_error("worker [%u] did not accept message %zi (%m), kill it\n", worker->pid, count);
+ log_error("worker [%u] did not accept message %zi (%m), kill it", worker->pid, count);
kill(worker->pid, SIGKILL);
worker->state = WORKER_KILLED;
continue;
@@ -419,7 +419,7 @@ static void event_run(struct event *event)
if (children >= children_max) {
if (children_max > 1)
- log_debug("maximum number (%i) of children reached\n", children);
+ log_debug("maximum number (%i) of children reached", children);
return;
}
@@ -450,7 +450,7 @@ static int event_queue_insert(struct udev_device *dev)
#endif
udev_queue_export_device_queued(udev_queue_export, dev);
- log_debug("seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev),
+ log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev),
udev_device_get_action(dev), udev_device_get_subsystem(dev));
event->state = EVENT_QUEUED;
@@ -635,24 +635,24 @@ static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl)
i = udev_ctrl_get_set_log_level(ctrl_msg);
if (i >= 0) {
- log_debug("udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i);
+ log_debug("udevd message (SET_LOG_PRIORITY) received, log_priority=%i", i);
log_set_max_level(i);
udev_set_log_priority(udev, i);
worker_kill(udev);
}
if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) {
- log_debug("udevd message (STOP_EXEC_QUEUE) received\n");
+ log_debug("udevd message (STOP_EXEC_QUEUE) received");
stop_exec_queue = true;
}
if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) {
- log_debug("udevd message (START_EXEC_QUEUE) received\n");
+ log_debug("udevd message (START_EXEC_QUEUE) received");
stop_exec_queue = false;
}
if (udev_ctrl_get_reload(ctrl_msg) > 0) {
- log_debug("udevd message (RELOAD) received\n");
+ log_debug("udevd message (RELOAD) received");
reload = true;
}
@@ -669,14 +669,14 @@ static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl)
val[0] = '\0';
val = &val[1];
if (val[0] == '\0') {
- log_debug("udevd message (ENV) received, unset '%s'\n", key);
+ log_debug("udevd message (ENV) received, unset '%s'", key);
udev_add_property(udev, key, NULL);
} else {
- log_debug("udevd message (ENV) received, set '%s=%s'\n", key, val);
+ log_debug("udevd message (ENV) received, set '%s=%s'", key, val);
udev_add_property(udev, key, val);
}
} else {
- log_error("wrong key format '%s'\n", key);
+ log_error("wrong key format '%s'", key);
}
free(key);
}
@@ -685,15 +685,15 @@ static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl)
i = udev_ctrl_get_set_children_max(ctrl_msg);
if (i >= 0) {
- log_debug("udevd message (SET_MAX_CHILDREN) received, children_max=%i\n", i);
+ log_debug("udevd message (SET_MAX_CHILDREN) received, children_max=%i", i);
children_max = i;
}
if (udev_ctrl_get_ping(ctrl_msg) > 0)
- log_debug("udevd message (SYNC) received\n");
+ log_debug("udevd message (SYNC) received");
if (udev_ctrl_get_exit(ctrl_msg) > 0) {
- log_debug("udevd message (EXIT) received\n");
+ log_debug("udevd message (EXIT) received");
udev_exit = true;
/* keep reference to block the client until we exit */
udev_ctrl_connection_ref(ctrl_conn);
@@ -715,7 +715,7 @@ static int handle_inotify(struct udev *udev)
buf = malloc(nbytes);
if (buf == NULL) {
- log_error("error getting buffer for inotify\n");
+ log_error("error getting buffer for inotify");
return -1;
}
@@ -727,17 +727,17 @@ static int handle_inotify(struct udev *udev)
ev = (struct inotify_event *)(buf + pos);
dev = udev_watch_lookup(udev, ev->wd);
if (dev != NULL) {
- log_debug("inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev));
+ log_debug("inotify event: %x for %s", ev->mask, udev_device_get_devnode(dev));
if (ev->mask & IN_CLOSE_WRITE) {
char filename[UTIL_PATH_SIZE];
int fd;
- log_debug("device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev));
+ log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
fd = open(filename, O_WRONLY);
if (fd >= 0) {
if (write(fd, "change", 6) < 0)
- log_debug("error writing uevent: %m\n");
+ log_debug("error writing uevent: %m");
close(fd);
}
}
@@ -775,26 +775,26 @@ static void handle_signal(struct udev *udev, int signo)
if (worker->pid != pid)
continue;
- log_debug("worker [%u] exit\n", pid);
+ log_debug("worker [%u] exit", pid);
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) != 0)
- log_error("worker [%u] exit with return code %i\n",
+ log_error("worker [%u] exit with return code %i",
pid, WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
- log_error("worker [%u] terminated by signal %i (%s)\n",
+ log_error("worker [%u] terminated by signal %i (%s)",
pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
} else if (WIFSTOPPED(status)) {
- log_error("worker [%u] stopped\n", pid);
+ log_error("worker [%u] stopped", pid);
} else if (WIFCONTINUED(status)) {
- log_error("worker [%u] continued\n", pid);
+ log_error("worker [%u] continued", pid);
} else {
- log_error("worker [%u] exit with status 0x%04x\n", pid, status);
+ log_error("worker [%u] exit with status 0x%04x", pid, status);
}
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
if (worker->event) {
- log_error("worker [%u] failed while handling '%s'\n",
+ log_error("worker [%u] failed while handling '%s'",
pid, worker->event->devpath);
worker->event->exitcode = -32;
event_queue_delete(worker->event, true);
@@ -843,7 +843,7 @@ static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink)
if (ctrl < 0 || netlink < 0)
return -1;
- log_debug("ctrl=%i netlink=%i\n", ctrl, netlink);
+ log_debug("ctrl=%i netlink=%i", ctrl, netlink);
*rctrl = ctrl;
*rnetlink = netlink;
return 0;
@@ -931,7 +931,7 @@ int main(int argc, char *argv[])
udev_set_log_fn(udev, udev_main_log);
log_set_max_level(udev_get_log_priority(udev));
- log_debug("version %s\n", VERSION);
+ log_debug("version %s", VERSION);
label_init("/dev");
for (;;) {
@@ -965,7 +965,7 @@ int main(int argc, char *argv[])
resolve_names = -1;
} else {
fprintf(stderr, "resolve-names must be early, late or never\n");
- log_error("resolve-names must be early, late or never\n");
+ log_error("resolve-names must be early, late or never");
goto exit;
}
break;
@@ -992,7 +992,7 @@ int main(int argc, char *argv[])
if (getuid() != 0) {
fprintf(stderr, "root privileges required\n");
- log_error("root privileges required\n");
+ log_error("root privileges required");
goto exit;
}
@@ -1018,7 +1018,7 @@ int main(int argc, char *argv[])
close(fd);
} else {
fprintf(stderr, "cannot open /dev/null\n");
- log_error("cannot open /dev/null\n");
+ log_error("cannot open /dev/null");
}
}
@@ -1033,7 +1033,7 @@ int main(int argc, char *argv[])
monitor = udev_monitor_new_from_netlink_fd(udev, "kernel", fd_netlink);
if (monitor == NULL) {
- log_error("error taking over netlink socket\n");
+ log_error("error taking over netlink socket");
rc = 3;
goto exit;
}
@@ -1055,7 +1055,7 @@ int main(int argc, char *argv[])
monitor = udev_monitor_new_from_netlink(udev, "kernel");
if (monitor == NULL) {
fprintf(stderr, "error initializing netlink socket\n");
- log_error("error initializing netlink socket\n");
+ log_error("error initializing netlink socket");
rc = 3;
goto exit;
}
@@ -1064,14 +1064,14 @@ int main(int argc, char *argv[])
if (udev_monitor_enable_receiving(monitor) < 0) {
fprintf(stderr, "error binding netlink socket\n");
- log_error("error binding netlink socket\n");
+ log_error("error binding netlink socket");
rc = 3;
goto exit;
}
if (udev_ctrl_enable_receiving(udev_ctrl) < 0) {
fprintf(stderr, "error binding udev control socket\n");
- log_error("error binding udev control socket\n");
+ log_error("error binding udev control socket");
rc = 1;
goto exit;
}
@@ -1081,7 +1081,7 @@ int main(int argc, char *argv[])
/* create queue file before signalling 'ready', to make sure we block 'settle' */
udev_queue_export = udev_queue_export_new(udev);
if (udev_queue_export == NULL) {
- log_error("error creating queue file\n");
+ log_error("error creating queue file");
goto exit;
}
@@ -1093,7 +1093,7 @@ int main(int argc, char *argv[])
case 0:
break;
case -1:
- log_error("fork of daemon failed: %m\n");
+ log_error("fork of daemon failed: %m");
rc = 4;
goto exit;
default:
@@ -1125,7 +1125,7 @@ int main(int argc, char *argv[])
fd_inotify = udev_watch_init(udev);
if (fd_inotify < 0) {
fprintf(stderr, "error initializing inotify\n");
- log_error("error initializing inotify\n");
+ log_error("error initializing inotify");
rc = 4;
goto exit;
}
@@ -1137,7 +1137,7 @@ int main(int argc, char *argv[])
fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
if (fd_signal < 0) {
fprintf(stderr, "error creating signalfd\n");
- log_error("error creating signalfd\n");
+ log_error("error creating signalfd");
rc = 5;
goto exit;
}
@@ -1145,7 +1145,7 @@ int main(int argc, char *argv[])
/* unnamed socket from workers to the main daemon */
if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) {
fprintf(stderr, "error creating socketpair\n");
- log_error("error creating socketpair\n");
+ log_error("error creating socketpair");
rc = 6;
goto exit;
}
@@ -1155,7 +1155,7 @@ int main(int argc, char *argv[])
rules = udev_rules_new(udev, resolve_names);
if (rules == NULL) {
- log_error("error reading rules\n");
+ log_error("error reading rules");
goto exit;
}
@@ -1181,7 +1181,7 @@ int main(int argc, char *argv[])
fd_ep = epoll_create1(EPOLL_CLOEXEC);
if (fd_ep < 0) {
- log_error("error creating epoll fd: %m\n");
+ log_error("error creating epoll fd: %m");
goto exit;
}
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_ctrl, &ep_ctrl) < 0 ||
@@ -1189,7 +1189,7 @@ int main(int argc, char *argv[])
epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 ||
epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_netlink, &ep_netlink) < 0 ||
epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_worker, &ep_worker) < 0) {
- log_error("fail to add fds to epoll: %m\n");
+ log_error("fail to add fds to epoll: %m");
goto exit;
}
@@ -1202,11 +1202,11 @@ int main(int argc, char *argv[])
children_max += CPU_COUNT(&cpu_set) * 2;
}
}
- log_debug("set children_max to %u\n", children_max);
+ log_debug("set children_max to %u", children_max);
rc = udev_rules_apply_static_dev_perms(rules);
if (rc < 0)
- log_error("failed to apply permissions on static device nodes - %s\n", strerror(-rc));
+ log_error("failed to apply permissions on static device nodes - %s", strerror(-rc));
udev_list_node_init(&event_list);
udev_list_node_init(&worker_list);
@@ -1266,13 +1266,13 @@ int main(int argc, char *argv[])
/* timeout */
if (udev_exit) {
- log_error("timeout, giving up waiting for workers to finish\n");
+ log_error("timeout, giving up waiting for workers to finish");
break;
}
/* kill idle workers */
if (udev_list_node_is_empty(&event_list)) {
- log_debug("cleanup idle workers\n");
+ log_debug("cleanup idle workers");
worker_kill(udev);
}
@@ -1284,14 +1284,14 @@ int main(int argc, char *argv[])
continue;
if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > 30 * 1000 * 1000) {
- log_error("worker [%u] %s timeout; kill it\n", worker->pid,
+ log_error("worker [%u] %s timeout; kill it", worker->pid,
worker->event ? worker->event->devpath : "<idle>");
kill(worker->pid, SIGKILL);
worker->state = WORKER_KILLED;
/* drop reference taken for state 'running' */
worker_unref(worker);
if (worker->event) {
- log_error("seq %llu '%s' killed\n",
+ log_error("seq %llu '%s' killed",
udev_device_get_seqnum(worker->event->dev), worker->event->devpath);
worker->event->exitcode = -64;
event_queue_delete(worker->event, true);