Name: sdbd
Summary: SDB daemon
-Version: 3.0.3
+Version: 3.0.4
Release: 0
License: Apache-2.0
Summary: SDB daemon
ExecStart=/usr/sbin/sdbd
[Install]
-WantedBy=multi-user.target
\ No newline at end of file
+WantedBy=multi-user.target
#include "file_sync_service.h"
#include "sdktools.h"
#include "sdbd_plugin.h"
+#include "utils.h"
#define SYNC_TIMEOUT 15
{
asprintf(&sdk_sync_permit_rule[0].regx, "^((/tmp)|(%s)|(%s))/[a-zA-Z0-9]{10}/data/[a-zA-Z0-9_\\-]{1,50}\\.xml$", APP_INSTALL_PATH_PREFIX1, APP_INSTALL_PATH_PREFIX2);
asprintf(&sdk_sync_permit_rule[1].regx, "^((/tmp)|(%s)|(%s))/[a-zA-Z0-9]{10}/data/+(.)*\\.gcda$", APP_INSTALL_PATH_PREFIX1, APP_INSTALL_PATH_PREFIX2);
- asprintf(&sdk_sync_permit_rule[2].regx, "da", "^(/tmp/da/)*+[a-zA-Z0-9_\\-\\.]{1,50}\\.png$");
+ asprintf(&sdk_sync_permit_rule[2].regx, "^(/tmp/da/)*+[a-zA-Z0-9_\\-\\.]{1,50}\\.png$");
}
send_device_status();
}
+void register_pwlock_cb() {
+ int ret = vconf_notify_key_changed(VCONFKEY_IDLE_LOCK_STATE, pwlock_cb, NULL);
+ if(ret != 0) {
+ D("cannot register vconf callback.\n");
+ return;
+ }
+ D("registered vconf callback\n");
+}
+
+void unregister_pwlock_cb() {
+ int ret = vconf_ignore_key_changed(VCONFKEY_IDLE_LOCK_STATE, pwlock_cb);
+ if(ret != 0) {
+ D("cannot unregister vconf callback.\n");
+ return;
+ }
+ D("unregistered vconf callback\n");
+}
+
static void *pwlock_thread(void *x) {
GMainLoop *loop;
loop = g_main_loop_new(NULL, FALSE);
return 0;
}
-
void create_pwlock_thread() {
sdb_thread_t t;
if(sdb_thread_create( &t, pwlock_thread, NULL)) {
D("created pwlock_thread\n");
}
-void register_pwlock_cb() {
- int ret = vconf_notify_key_changed(VCONFKEY_IDLE_LOCK_STATE, pwlock_cb, NULL);
- if(ret != 0) {
- D("cannot register vconf callback.\n");
- return;
- }
- D("registered vconf callback\n");
-}
-
-void unregister_pwlock_cb() {
- int ret = vconf_ignore_key_changed(VCONFKEY_IDLE_LOCK_STATE, pwlock_cb);
- if(ret != 0) {
- D("cannot unregister vconf callback.\n");
- return;
- }
- D("unregistered vconf callback\n");
-}
-
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
int list_transports(char *buf, size_t bufsize);
void update_transports(void);
void broadcast_transport(apacket *p);
+int get_connected_count(transport_type type);
asocket* create_device_tracker(void);
#endif
#include "strutils.h"
+#include "utils.h"
#include <system_info.h>
#include <tzplatform_config.h>
snprintf(path, sizeof(path), "%s", trim_value);
}
envp[3] = path;
- free(trim_value);
} else {
snprintf(path, sizeof(path), "%s", value);
envp[3] = path;
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
+#include <ctype.h>
#define STRING_MAXLEN 1024
char*
return buff;
}
-char *str_trim(const char* string)
-{
- const char* s = string;
- const char* e = string + (strlen(string) - 1);
- char* ret;
-
- while(*s == ' ' || *s == '\t') // ltrim
- s++;
- while(*e == ' ' || *e == '\t') // rtrim
- e--;
-
- ret = strdup(s);
- if(ret == NULL) {
- return NULL;
- }
- ret[e - s + 1] = 0;
+char *str_trim(char *str) {
+ size_t len = 0;
+ char *frontp = str;
+ char *endp = NULL;
- return ret;
+ if (str == NULL) {
+ return NULL;
+ }
+ if (str[0] == '\0') {
+ return str;
+ }
+
+ len = strlen(str);
+ endp = str + len;
+
+ while (isspace(*frontp)) {
+ ++frontp;
+ }
+ if (endp != frontp) {
+ while (isspace(*(--endp)) && endp != frontp) {
+ }
+ }
+
+ if (str + len - 1 != endp)
+ *(endp + 1) = '\0';
+ else if (frontp != str && endp == frontp)
+ *str = '\0';
+
+ endp = str;
+ if (frontp != str) {
+ while (*frontp) {
+ *endp++ = *frontp++;
+ }
+ *endp = '\0';
+ }
+ return str;
}
int spawn(char* program, char** arg_list)
#define BUFF_DECL(_buff,_cursor,_end,_size) \
char _buff[_size], *_cursor=_buff, *_end = _cursor + (_size)
-char *str_trim(const char* string);
+char *str_trim(char* string);
/*
* spawn a process and returns the process id of the new spawned process.