Merge the desc data.
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 3 Apr 2013 18:54:53 +0000 (18:54 +0000)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 3 Apr 2013 18:54:53 +0000 (18:54 +0000)
If it is not read by the script engine of provider,
merge new desc blocks with previous one.

script engine should know the context of desc blocks.

Change-Id: I7855491559be50e58c2549dcd96084750eacf57b

src/livebox.c

index 1bf1f7e..339e59c 100644 (file)
@@ -19,6 +19,7 @@
 #include <stdlib.h> /* malloc */
 #include <string.h> /* strdup */
 #include <libgen.h>
+#include <unistd.h> /* access */
 
 #include <dlog.h>
 #include <livebox-service.h>
@@ -113,8 +114,11 @@ PUBLIC struct livebox_desc *livebox_desc_open(const char *filename, int for_pd)
                }
        }
 
-       DbgPrint("Open a new file: %s\n", new_fname);
-       handle->fp = fopen(new_fname, "w+t");
+       DbgPrint("Open a file %s with merge mode %s\n",
+                               new_fname,
+                               access(new_fname, F_OK) == 0 ? "enabled" : "disabled");
+
+       handle->fp = fopen(new_fname, "at");
        free(new_fname);
        if (!handle->fp) {
                ErrPrint("Failed to open a file: %s\n", strerror(errno));