diff options
author | Rosen Penev <rosenp@gmail.com> | 2019-07-18 10:54:44 -0700 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-03 11:26:51 +0200 |
commit | 604db20aa6b1e573ddc0d5d3662988244701b13f (patch) | |
tree | dde261d5adf4553abf94fc8177e051f9c37e845c | |
parent | 821045f6ce341fdc39fc8dafc765411b0f4954d1 (diff) | |
download | rpcd-604db20aa6b1e573ddc0d5d3662988244701b13f.tar.gz |
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
uClibc-ng).
nanosleep also has the advantage of being more accurate.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
[move timespec definition to the top of the function]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | sys.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |