summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/udev/udev-builtin-blkid.c1
-rw-r--r--src/udev/udev-builtin-input_id.c5
-rw-r--r--src/udev/udev-builtin-usb_id.c7
-rw-r--r--src/udev/udev-ctrl.c1
-rw-r--r--src/udev/udev-event.c8
-rw-r--r--src/udev/udev-node.c5
-rw-r--r--src/udev/udev-rules.c5
-rw-r--r--src/udev/udevadm-info.c1
-rw-r--r--src/udev/udevadm-trigger.c1
-rw-r--r--src/udev/udevd.c12
10 files changed, 15 insertions, 31 deletions
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index 174e20e2fa..c6dee9c3cf 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -115,7 +115,6 @@ static int probe_superblocks(blkid_probe pr)
static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test)
{
- struct udev *udev = udev_device_get_udev(dev);
int64_t offset = 0;
bool noraid = false;
int fd = -1;
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
index ee8294b700..fce10a351a 100644
--- a/src/udev/udev-builtin-input_id.c
+++ b/src/udev/udev-builtin-input_id.c
@@ -38,6 +38,8 @@
#define LONG(x) ((x)/BITS_PER_LONG)
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
/*
* Read a capability attribute and return bitmask.
* @param dev udev_device
@@ -49,7 +51,6 @@ static void get_cap_mask(struct udev_device *dev,
unsigned long *bitmask, size_t bitmask_size,
bool test)
{
- struct udev *udev = udev_device_get_udev(dev);
char text[4096];
unsigned i;
char* word;
@@ -87,6 +88,7 @@ static void get_cap_mask(struct udev_device *dev,
log_debug(text, i * BITS_PER_LONG, bitmask[i]);
}
}
+#pragma GCC diagnostic pop
/* pointer devices */
static void test_pointers (struct udev_device *dev,
@@ -143,7 +145,6 @@ static void test_key (struct udev_device *dev,
const unsigned long* bitmask_key,
bool test)
{
- struct udev *udev = udev_device_get_udev(dev);
unsigned i;
unsigned long found;
unsigned long mask;
diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c
index 6481b35ae7..18e10c4cc8 100644
--- a/src/udev/udev-builtin-usb_id.c
+++ b/src/udev/udev-builtin-usb_id.c
@@ -33,7 +33,7 @@
static void set_usb_iftype(char *to, int if_class_num, size_t len)
{
- char *type = "generic";
+ const char *type = "generic";
switch (if_class_num) {
case 1:
@@ -86,7 +86,7 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len
{
int type_num = 0;
char *eptr;
- char *type = "generic";
+ const char *type = "generic";
type_num = strtoul(from, &eptr, 0);
if (eptr != from) {
@@ -119,7 +119,7 @@ static void set_scsi_type(char *to, const char *from, size_t len)
{
int type_num;
char *eptr;
- char *type = "generic";
+ const char *type = "generic";
type_num = strtoul(from, &eptr, 0);
if (eptr != from) {
@@ -256,7 +256,6 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool
const char *driver = NULL;
char serial[256];
- struct udev *udev = udev_device_get_udev(dev);
struct udev_device *dev_interface = NULL;
struct udev_device *dev_usb = NULL;
const char *if_class, *if_subclass;
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index dd345f80a2..71c330f6f9 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -337,7 +337,6 @@ int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout)
struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn)
{
- struct udev *udev = conn->uctrl->udev;
struct udev_ctrl_msg *uctrl_msg;
ssize_t size;
struct msghdr smsg;
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index afbfebb3a9..debda61eed 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -86,8 +86,8 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char *
SUBST_SYS,
};
static const struct subst_map {
- char *name;
- char fmt;
+ const char *name;
+ const char fmt;
enum subst_type type;
} map[] = {
{ .name = "devnode", .fmt = 'N', .type = SUBST_DEVNODE },
@@ -386,7 +386,6 @@ static int spawn_exec(struct udev_event *event,
const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask,
int fd_stdout, int fd_stderr)
{
- struct udev *udev = event->udev;
int err;
int fd;
@@ -433,7 +432,6 @@ static void spawn_read(struct udev_event *event,
int fd_stdout, int fd_stderr,
char *result, size_t ressize)
{
- struct udev *udev = event->udev;
size_t respos = 0;
int fd_ep = -1;
struct epoll_event ep_outpipe, ep_errpipe;
@@ -553,7 +551,6 @@ out:
static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
{
- struct udev *udev = event->udev;
struct pollfd pfd[1];
int err = 0;
@@ -939,7 +936,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
udev_device_unref(event->dev_db);
event->dev_db = NULL;
}
-out:
return err;
}
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 95edd972f2..8e1318872a 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -240,7 +240,6 @@ static void link_update(struct udev_device *dev, const char *slink, bool add)
void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old)
{
- struct udev *udev = udev_device_get_udev(dev);
struct udev_list_entry *list_entry;
/* update possible left-over symlinks */
@@ -322,7 +321,6 @@ void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid)
struct udev *udev = udev_device_get_udev(dev);
char filename[UTIL_PATH_SIZE];
struct udev_list_entry *list_entry;
- int err = 0;
log_debug("handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n",
udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid);
@@ -351,9 +349,6 @@ void udev_node_remove(struct udev_device *dev)
{
struct udev *udev = udev_device_get_udev(dev);
struct udev_list_entry *list_entry;
- const char *devnode;
- struct stat stats;
- struct udev_device *dev_check;
char filename[UTIL_PATH_SIZE];
/* remove/update symlinks, remove symlinks from name index */
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 401da5d8c5..c371298a69 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -781,7 +781,6 @@ static int import_program_into_properties(struct udev_event *event, const char *
static int import_parent_into_properties(struct udev_device *dev, const char *filter)
{
- struct udev *udev = udev_device_get_udev(dev);
struct udev_device *dev_parent;
struct udev_list_entry *list_entry;
@@ -969,7 +968,7 @@ static int get_key(struct udev *udev, char **line, char **key, enum operation_ty
}
/* extract possible KEY{attr} */
-static char *get_key_attribute(struct udev *udev, char *str)
+static const char *get_key_attribute(struct udev *udev, char *str)
{
char *pos;
char *attr;
@@ -1178,7 +1177,7 @@ static int add_rule(struct udev_rules *rules, char *line,
const char *filename, unsigned int filename_off, unsigned int lineno)
{
char *linepos;
- char *attr;
+ const char *attr;
struct rule_tmp rule_tmp;
memset(&rule_tmp, 0x00, sizeof(struct rule_tmp));
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index 20a70cb458..f392818c83 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -52,7 +52,6 @@ static bool skip_attribute(const char *name)
static void print_all_attributes(struct udev_device *device, const char *key)
{
- struct udev *udev = udev_device_get_udev(device);
struct udev_list_entry *sysattr;
udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) {
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 36a2864fa7..99ef12cb85 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -38,7 +38,6 @@ static int dry_run;
static void exec_list(struct udev_enumerate *udev_enumerate, const char *action)
{
- struct udev *udev = udev_enumerate_get_udev(udev_enumerate);
struct udev_list_entry *entry;
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) {
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 35478c19ca..fc33ff0117 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -880,11 +880,6 @@ static void static_dev_create_from_modules(struct udev *udev)
static void static_dev_create_links(struct udev *udev)
{
DIR *dir;
-
- dir = opendir(udev_get_dev_path(udev));
- if (dir == NULL)
- return;
-
struct stdlinks {
const char *link;
const char *target;
@@ -898,6 +893,10 @@ static void static_dev_create_links(struct udev *udev)
};
unsigned int i;
+ dir = opendir(udev_get_dev_path(udev));
+ if (dir == NULL)
+ return;
+
for (i = 0; i < ARRAY_SIZE(stdlinks); i++) {
struct stat sb;
@@ -1115,7 +1114,6 @@ int main(int argc, char *argv[])
int fd_worker = -1;
struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker;
struct udev_ctrl_connection *ctrl_conn = NULL;
- char **s;
int rc = 1;
udev = udev_new();
@@ -1525,7 +1523,7 @@ int main(int argc, char *argv[])
continue;
if ((now_usec() - worker->event_start_usec) > 30 * 1000 * 1000) {
- log_error("worker [%u] timeout, kill it\n", worker->pid,
+ log_error("worker [%u] %s timeout; kill it\n", worker->pid,
worker->event ? worker->event->devpath : "<idle>");
kill(worker->pid, SIGKILL);
worker->state = WORKER_KILLED;