From dda5531a160fe43b35c8da5f6a149e4f9c561877 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 24 Oct 2007 15:02:51 +0200 Subject: [PATCH] Reset afd fields on eof. Don't print stale status info when stopped. --- command.c | 12 ++++++++---- vss.c | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/command.c b/command.c index 2ccbe394..dae21e6d 100644 --- a/command.c +++ b/command.c @@ -104,13 +104,15 @@ static char *get_status(struct misc_meta_data *nmmd) struct timeval now; struct tm mtime_tm; - localtime_r(&nmmd->mtime, &mtime_tm); - strftime(mtime, 29, "%a %b %d %Y", &mtime_tm); /* report real status */ status = vss_status_tohuman(nmmd->vss_status_flags); flags = vss_get_status_flags(nmmd->vss_status_flags); basename = para_basename(nmmd->afd.path); dirname = para_dirname(nmmd->afd.path); + if (basename) { + localtime_r(&nmmd->mtime, &mtime_tm); + strftime(mtime, 29, "%a %b %d %Y", &mtime_tm); + } gettimeofday(&now, NULL); ret = make_message( "%s:%zu\n" "%s:%s\n" "%s:%lu\n" "%s:%u\n" @@ -129,7 +131,9 @@ static char *get_status(struct misc_meta_data *nmmd) status_item_list[SI_IMAGE_ID], nmmd->afd.afsi.image_id, status_item_list[SI_OFFSET], offset, - status_item_list[SI_FORMAT], audio_format_name(nmmd->afd.afsi.audio_format_id), + status_item_list[SI_FORMAT], basename? + audio_format_name(nmmd->afd.afsi.audio_format_id) + : "", status_item_list[SI_AFS_MODE], mmd->afs_mode_string, nmmd->afd.afhi.info_string, @@ -142,7 +146,7 @@ static char *get_status(struct misc_meta_data *nmmd) (long unsigned)now.tv_usec, status_item_list[SI_ATTRIBUTES], mmd->afd.attributes_string, - status_item_list[SI_DIRECTORY], dirname, + status_item_list[SI_DIRECTORY], dirname? dirname : "(none)", status_item_list[SI_LYRICS_ID], nmmd->afd.afsi.lyrics_id ); diff --git a/vss.c b/vss.c index c676ead5..826191bc 100644 --- a/vss.c +++ b/vss.c @@ -202,6 +202,10 @@ static void vss_eof(void) strcpy(mmd->afd.afhi.info_string, tmp); free(tmp); mmd->afd.path[0] = '\0'; + mmd->afd.afsi.lyrics_id = 0; + mmd->afd.afsi.image_id = 0; + mmd->mtime = 0; + mmd->afd.attributes_string[0] = '\0'; mmd->size = 0; mmd->events++; } -- 2.39.5