rpcd: sys: actually move timespec declaration

Move the timespec declaration to the function header, as mentioned in
commit "rpcd: Switch to nanosleep".

Fixes: 604db20 ("rpcd: Switch to nanosleep")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2019-09-03 11:36:31 +02:00
parent 345363bf47
commit 27c24c7c18

2
sys.c
View file

@ -88,6 +88,7 @@ rpc_cgi_password_set(struct ubus_context *ctx, struct ubus_object *obj,
ssize_t n; ssize_t n;
int ret; int ret;
const char *const passwd = "/bin/passwd"; const char *const passwd = "/bin/passwd";
const struct timespec req = {0, 100 * 1000 * 1000};
blobmsg_parse(rpc_password_policy, __RPC_P_MAX, tb, blobmsg_parse(rpc_password_policy, __RPC_P_MAX, tb,
blob_data(msg), blob_len(msg)); blob_data(msg), blob_len(msg));
@ -145,7 +146,6 @@ rpc_cgi_password_set(struct ubus_context *ctx, struct ubus_object *obj,
if (n < 0) if (n < 0)
return rpc_errno_status(); return rpc_errno_status();
const struct timespec req = {0, 100 * 1000 * 1000};
nanosleep(&req, NULL); nanosleep(&req, NULL);
n = write(fds[1], blobmsg_data(tb[RPC_P_PASSWORD]), n = write(fds[1], blobmsg_data(tb[RPC_P_PASSWORD]),