Commit 604db20a authored by Rosen Penev's avatar Rosen Penev Committed by Jo-Philipp Wich

rpcd: Switch to nanosleep

usleep has been deprecated by POSIX.1-2001 and removed in POSIX.1-2008.
Fixes compilation when libc does not include usleep (optional with

nanosleep also has the advantage of being more accurate.
Signed-off-by: default avatarRosen Penev <>
[move timespec definition to the top of the function]
Signed-off-by: default avatarJo-Philipp Wich <>
parent 821045f6
......@@ -145,7 +145,8 @@ rpc_cgi_password_set(struct ubus_context *ctx, struct ubus_object *obj,
if (n < 0)
return rpc_errno_status();
usleep(100 * 1000);
const struct timespec req = {0, 100 * 1000 * 1000};
nanosleep(&req, NULL);
n = write(fds[1], blobmsg_data(tb[RPC_P_PASSWORD]),
blobmsg_data_len(tb[RPC_P_PASSWORD]) - 1);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment