From b30c1450a8477f6a3fc23a1bbd1768831f7321fb Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 15 Jan 2018 02:58:57 +0000 Subject: Small bugfixes --- src/mdevd/mdevd-coldplug.c | 6 +----- src/mdevd/mdevd.c | 7 +++---- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mdevd/mdevd-coldplug.c b/src/mdevd/mdevd-coldplug.c index 0d64007..720a7cc 100644 --- a/src/mdevd/mdevd-coldplug.c +++ b/src/mdevd/mdevd-coldplug.c @@ -33,11 +33,7 @@ static void scan_subdir (int fdat, char const *pathat, char const *list) memcpy(fn, d->d_name, dlen) ; memcpy(fn + dlen, "/uevent", 8) ; fd = openat(fdlist, fn, O_WRONLY) ; - if (fd < 0) - { - strerr_warnwu6sys("open ", pathat, "/", list, "/", fn) ; - continue ; - } + if (fd < 0) continue ; if (write(fd, "add\n", 4) < 4) strerr_warnwu6sys("write to ", pathat, "/", list, "/", fn) ; close(fd) ; diff --git a/src/mdevd/mdevd.c b/src/mdevd/mdevd.c index 660dc87..8671600 100644 --- a/src/mdevd/mdevd.c +++ b/src/mdevd/mdevd.c @@ -933,12 +933,11 @@ static inline void on_event (struct uevent_s *event, scriptelem const *script, u { size_t devpathlen = strlen(x) ; size_t slashsyslen = strlen(slashsys) ; - char sysdevpath[devpathlen + slashsyslen + 2 + 7] ; + char sysdevpath[devpathlen + slashsyslen + 8] ; /* act_on_event needs the extra storage */ memcpy(sysdevpath, slashsys, slashsyslen) ; - sysdevpath[slashsyslen] = '/' ; - memcpy(sysdevpath + slashsyslen + 1, x, devpathlen + 1) ; + memcpy(sysdevpath + slashsyslen, x, devpathlen + 1) ; x = event_getvar(event, "FIRMWARE") ; - if (action == ACTION_ADD || !x) act_on_event(event, sysdevpath, slashsyslen + devpathlen + 1, action, script, scriptlen, storage, envmatch) ; + if (action == ACTION_ADD || !x) act_on_event(event, sysdevpath, slashsyslen + devpathlen, action, script, scriptlen, storage, envmatch) ; if (action == ACTION_ADD && x) load_firmware(x, sysdevpath) ; } } -- cgit v1.2.3