Rip out setting of the log level from udev_new and put it in a new function

This function is internal to systemd code, so external users of libudev
will not see those log messages. I think this is better. If we want to
allow that, the function could be put in libudev and exported.

v2: check that the string is more than one char before stripping quotes
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-05-07 22:49:12 -04:00
parent 5c72049f91
commit b237a168df
11 changed files with 82 additions and 82 deletions
+2
View File
@@ -427,6 +427,8 @@ int main(int argc, char *argv[])
{}
};
log_set_target(LOG_TARGET_AUTO);
udev_parse_config();
log_parse_environment();
log_open();
+4 -2
View File
@@ -38,6 +38,7 @@
#include "libudev-private.h"
#include "random-util.h"
#include "udev-util.h"
/* device info */
static unsigned int cd_cd_rom;
@@ -843,8 +844,7 @@ static int cd_media_toc(struct udev *udev, int fd)
return 0;
}
int main(int argc, char *argv[])
{
int main(int argc, char *argv[]) {
struct udev *udev;
static const struct option options[] = {
{ "lock-media", no_argument, NULL, 'l' },
@@ -862,6 +862,8 @@ int main(int argc, char *argv[])
int cnt;
int rc = 0;
log_set_target(LOG_TARGET_AUTO);
udev_parse_config();
log_parse_environment();
log_open();
+6
View File
@@ -29,6 +29,7 @@
#include "macro.h"
#include "stdio-util.h"
#include "string-util.h"
#include "udev-util.h"
#define BUFSIZE 16
#define UDEV_ALARM_TIMEOUT 180
@@ -361,6 +362,11 @@ int main(int argc, char **argv)
int prune = 0;
char tmpdir[UTIL_PATH_SIZE];
log_set_target(LOG_TARGET_AUTO);
udev_parse_config();
log_parse_environment();
log_open();
udev = udev_new();
if (udev == NULL) {
ret = EXIT_FAILURE;
+2
View File
@@ -577,6 +577,8 @@ int main(int argc, char **argv)
int newargc;
char **newargv = NULL;
log_set_target(LOG_TARGET_AUTO);
udev_parse_config();
log_parse_environment();
log_open();
+7 -4
View File
@@ -23,6 +23,7 @@
#include "selinux-util.h"
#include "string-util.h"
#include "udev.h"
#include "udev-util.h"
static int adm_version(struct udev *udev, int argc, char *argv[]) {
printf("%s\n", PACKAGE_VERSION);
@@ -87,14 +88,16 @@ int main(int argc, char *argv[]) {
unsigned int i;
int rc = 1, c;
udev_parse_config();
log_parse_environment();
log_open();
mac_selinux_init();
udev = udev_new();
if (udev == NULL)
goto out;
log_parse_environment();
log_open();
mac_selinux_init();
while ((c = getopt_long(argc, argv, "+dhV", options, NULL)) >= 0)
switch (c) {
+1
View File
@@ -1663,6 +1663,7 @@ int main(int argc, char *argv[]) {
int r;
log_set_target(LOG_TARGET_AUTO);
udev_parse_config();
log_parse_environment();
log_open();