summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mdevd/mdevd-coldplug.c6
-rw-r--r--src/mdevd/mdevd.c7
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) ;
}
}