#include <fcntl.h>
#include <errno.h>
#include <string.h>
-#include <syslog.h>
#include <ctype.h>
#include <getopt.h>
#include <sys/stat.h>
static char config_file[MAX_PATH_LEN] = "/etc/scsi_id.config";
static enum page_code default_page_code = PAGE_UNSPECIFIED;
static int sg_version = 4;
-static int debug = 0;
static bool reformat_serial = false;
static bool export = false;
static char vendor_str[64];
static char revision_str[16];
static char type_str[16];
-_printf_(6,0)
-static void log_fn(struct udev *udev, int priority,
- const char *file, int line, const char *fn,
- const char *format, va_list args)
-{
- vsyslog(priority, format, args);
-}
-
static void set_type(const char *from, char *to, size_t len)
{
int type_num;
if (errno == ENOENT)
return 1;
else {
- log_error("can't open %s: %m", config_file);
+ log_error_errno(errno, "can't open %s: %m", config_file);
return -1;
}
}
" -f,--config= location of config file\n"
" -p,--page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n"
" -s,--sg-version=3|4 use SGv3 or SGv4\n"
- " -b,--blacklisted threat device as blacklisted\n"
- " -g,--whitelisted threat device as whitelisted\n"
+ " -b,--blacklisted treat device as blacklisted\n"
+ " -g,--whitelisted treat device as whitelisted\n"
" -u,--replace-whitespace replace all whitespace by underscores\n"
" -v,--verbose verbose logging\n"
" --version print version\n"
break;
case 'v':
- debug++;
+ log_set_target(LOG_TARGET_CONSOLE);
+ log_set_max_level(LOG_DEBUG);
+ log_open();
break;
case 'V':
int newargc;
char **newargv = NULL;
+ log_parse_environment();
+ log_open();
+
udev = udev_new();
if (udev == NULL)
goto exit;
- log_open();
- udev_set_log_fn(udev, log_fn);
-
/*
* Get config file options.
*/