+int util_unlink(const char *filename)
+{
+ char *descfile;
+ int desclen;
+ int ret;
+
+ if (!filename) {
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ desclen = strlen(filename) + 6; /* .desc */
+ descfile = malloc(desclen);
+ if (!descfile) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return LB_STATUS_ERROR_MEMORY;
+ }
+
+ ret = snprintf(descfile, desclen, "%s.desc", filename);
+ if (ret < 0) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(descfile);
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ (void)unlink(descfile);
+ free(descfile);
+ (void)unlink(filename);
+
+ return LB_STATUS_SUCCESS;
+}
+