summaryrefslogtreecommitdiff
path: root/src/device_manager_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/device_manager_io.c')
-rw-r--r--src/device_manager_io.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/device_manager_io.c b/src/device_manager_io.c
index 0e1ed5e..b3caf8d 100644
--- a/src/device_manager_io.c
+++ b/src/device_manager_io.c
@@ -141,15 +141,17 @@ int sys_get_int(char *fname, int *val)
}
}
-char *sys_get_str(char *fname)
+int sys_get_str(char *fname, char *str)
{
- char buf[BUFF_MAX];
- char *r = NULL;
+ char buf[BUFF_MAX] = {0};
if (sys_read_buf(fname, buf) == 0)
- r = strdup((char *)buf);
+ {
+ strncpy(str, buf, strlen(buf));
+ return 0;
+ }
- return r;
+ return -1;
}
int sys_set_int(char *fname, int val)