mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 06:12:01 +01:00
ctladm: Fix a race when loading ctl.ko
If multiple ctladm processes try to load ctl.ko at the same time, only one will succeed. Handle this possibility by retrying the operation (open /dev/cam/ctl) if kldload returns EEXIST, rather than bailing. This at least helps ensure that ctladm tests can be run in parallel when ctl.ko is not preloaded. Reviewed by: asomers MFC after: 1 week
This commit is contained in:
parent
f29bdea047
commit
7d6932d20a
@ -4469,7 +4469,7 @@ main(int argc, char **argv)
|
||||
if (fd == -1 && errno == ENOENT) {
|
||||
saved_errno = errno;
|
||||
retval = kldload("ctl");
|
||||
if (retval != -1)
|
||||
if (retval != -1 || errno == EEXIST)
|
||||
fd = open(device, O_RDWR);
|
||||
else
|
||||
errno = saved_errno;
|
||||
|
Loading…
Reference in New Issue
Block a user