file: increase minimum read buffer size to 4096 bytes
[project/rpcd.git] / sys.c
diff --git a/sys.c b/sys.c
index 43eadc411402d2628fedea44fa59651e82ce688d..fecf66cb2e722ad2b1a227c1624488866a2cc3bd 100644 (file)
--- a/sys.c
+++ b/sys.c
@@ -88,6 +88,7 @@ rpc_cgi_password_set(struct ubus_context *ctx, struct ubus_object *obj,
        ssize_t n;
        int ret;
        const char *const passwd = "/bin/passwd";
+       const struct timespec ts = {0, 100 * 1000 * 1000};
 
        blobmsg_parse(rpc_password_policy, __RPC_P_MAX, tb,
                      blob_data(msg), blob_len(msg));
@@ -145,7 +146,7 @@ rpc_cgi_password_set(struct ubus_context *ctx, struct ubus_object *obj,
                if (n < 0)
                        return rpc_errno_status();
 
-               usleep(100 * 1000);
+               nanosleep(&ts, NULL);
 
                n = write(fds[1], blobmsg_data(tb[RPC_P_PASSWORD]),
                              blobmsg_data_len(tb[RPC_P_PASSWORD]) - 1);