You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.3 KiB

--- a/diags/diag_disk.c
+++ b/diags/diag_disk.c
@@ -344,7 +344,7 @@
return rc;
}
-static int remove_old_log_file(char *xml_filename)
+static int remove_old_log_file(void)
{
DIR *d;
struct dirent *namelist;
@@ -357,9 +357,6 @@
while ((namelist = readdir(d)) != NULL) {
if (namelist->d_name[0] == '.')
- continue;
-
- if (!strcmp(xml_filename, namelist->d_name))
continue;
snprintf(filename, sizeof(filename) - 1, "%s/%s", OUTPUT_PATH,
@@ -416,10 +413,11 @@
/* file format */
snprintf(xml_filename, sizeof(xml_filename) - 1,
- "%s~%s~%s~diskAnalytics~%d%02d%02d%02d%02d%02d.xml",
- mach_type_model, mach_model, serial_num,
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec);
+ "%s~%s~%s~diskAnalytics.xml",
+ mach_type_model, mach_model, serial_num);
+
+ /* Try to remove old log file. We will continue even if this fails */
+ remove_old_log_file();
/* open file */
ret = open_output_xml_file(xml_filename);
@@ -441,12 +439,5 @@
/* close output xml file descriptor */
close_output_xml_file();
- /* remove old log file */
- ret = remove_old_log_file(xml_filename);
- if (ret) {
- fprintf(stderr, "Unable to remove old output log file.\n");
- return -1;
- }
-
- return 0;
-}
+ return 0;
+}