diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-01-15 02:58:57 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-01-15 02:58:57 +0000 |
commit | b30c1450a8477f6a3fc23a1bbd1768831f7321fb (patch) | |
tree | de7a0f3662581440e74a8e1ee10652793d7d0d1e | |
parent | ddd67a294cb769c2935548fdd455459695024e33 (diff) | |
download | mdevd-b30c1450a8477f6a3fc23a1bbd1768831f7321fb.tar.xz |
Small bugfixes
-rw-r--r-- | src/mdevd/mdevd-coldplug.c | 6 | ||||
-rw-r--r-- | src/mdevd/mdevd.c | 7 |
2 files changed, 4 insertions, 9 deletions
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) ; } } |