timeshift: previous files not cleaned [1/1]
PD#SWPL-127527
Problem:
bad string check
Solution:
fix the string of filename from location
Verify:
PB
Change-Id: I9f6892e0759047d380e0169142af63e6a12a8384
Signed-off-by: Zhiqiang Han <zhiqiang.han@amlogic.com>
diff --git a/src/dvr_segment.c b/src/dvr_segment.c
index 95ca2b6..7c39a64 100644
--- a/src/dvr_segment.c
+++ b/src/dvr_segment.c
@@ -98,6 +98,10 @@
/*get the dirname and filename*/
loc_fname = strrchr(location, '/');// fine last slash
loc_fname_len = strlen(loc_fname);
+ if (loc_fname) {// skip the slash
+ loc_fname += 1;
+ loc_fname_len -= 1;
+ }
DVR_RETURN_IF_FALSE(loc_fname_len != 0);
loc_dname_len = loc_fname - location;
@@ -117,6 +121,8 @@
snprintf(path, path_size, "%s/%s", loc_dname, entry->d_name);
if (remove(path) != 0) {
DVR_INFO("%s cannot delete file:%s", __func__, path);
+ } else {
+ //DVR_INFO("rm [%s] ok", path);
}
}
}