]> git.tue.mpg.de Git - paraslash.git/commitdiff
Reset afd fields on eof.
authorAndre Noll <maan@systemlinux.org>
Wed, 24 Oct 2007 13:02:51 +0000 (15:02 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 24 Oct 2007 13:02:51 +0000 (15:02 +0200)
Don't print stale status info when stopped.

command.c
vss.c

index 2ccbe394b7119f70d4baad1c77d52b300c85e818..dae21e6d037dda6d920bd4b0ed7e9094cef777f4 100644 (file)
--- 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 c676ead505671f1a145f950620742a299a594fb6..826191bc100d5fb36bb9d0ed3482ff2dce36b21d 100644 (file)
--- 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++;
 }