Skip to content

Commit

Permalink
res: ubr: simplify code after scandir in _update_disk_deps_from_sysfs
Browse files Browse the repository at this point in the history
  • Loading branch information
prajnoha committed May 27, 2024
1 parent 451fd88 commit 3d82efe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/resource/ubridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -4427,19 +4427,19 @@ static int _update_disk_deps_from_sysfs(sid_res_t *cmd_res)
goto out;
}

if ((count = scandir(s, &dirent, NULL, NULL)) < 0) {
count = scandir(s, &dirent, NULL, NULL);
sid_buf_mem_rewind(ucmd_ctx->common->gen_buf, s);

if (count < 0) {
/*
* FIXME: Add code to deal with/warn about: (errno == ENOENT) && (ucmd_ctx->req_env.dev.udev.action !=
* UDEV_ACTION_REMOVE). That means we don't have REMOVE uevent, but at the same time, we don't have sysfs
* content, e.g. because we're processing this uevent too late: the device has already been removed right
* after this uevent was triggered. For now, error out even in this case.
*/
sid_res_log_sys_error(cmd_res, "scandir", s);
sid_buf_mem_rewind(ucmd_ctx->common->gen_buf, s);
goto out;
}

sid_buf_mem_rewind(ucmd_ctx->common->gen_buf, s);
}

/*
Expand Down

0 comments on commit 3d82efe

Please sign in to comment.