|
@@ -9,6 +9,7 @@
|
|
* manipulate wakelocks on Android.
|
|
* manipulate wakelocks on Android.
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+#include <linux/capability.h>
|
|
#include <linux/ctype.h>
|
|
#include <linux/ctype.h>
|
|
#include <linux/device.h>
|
|
#include <linux/device.h>
|
|
#include <linux/err.h>
|
|
#include <linux/err.h>
|
|
@@ -188,6 +189,9 @@ int pm_wake_lock(const char *buf)
|
|
size_t len;
|
|
size_t len;
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
|
|
|
|
+ if (!capable(CAP_BLOCK_SUSPEND))
|
|
|
|
+ return -EPERM;
|
|
|
|
+
|
|
while (*str && !isspace(*str))
|
|
while (*str && !isspace(*str))
|
|
str++;
|
|
str++;
|
|
|
|
|
|
@@ -231,6 +235,9 @@ int pm_wake_unlock(const char *buf)
|
|
size_t len;
|
|
size_t len;
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
|
|
|
|
+ if (!capable(CAP_BLOCK_SUSPEND))
|
|
|
|
+ return -EPERM;
|
|
|
|
+
|
|
len = strlen(buf);
|
|
len = strlen(buf);
|
|
if (!len)
|
|
if (!len)
|
|
return -EINVAL;
|
|
return -EINVAL;
|