]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - term-utils/agetty.c
agetty: make reload code more robust
[thirdparty/util-linux.git] / term-utils / agetty.c
index 5963e83176c2328e6efbca1c06ce7e7098809450..94b77562451b3bd79a1603123f7fee1e4ab06b52 100644 (file)
@@ -1877,6 +1877,7 @@ static int issue_is_changed(struct issue *ie)
                free(ie->mem_old);
                ie->mem_old = ie->mem;
                ie->mem = NULL;
+               ie->mem_sz = 0;
                return 0;
        }
 
@@ -1903,7 +1904,7 @@ static void print_issue_file(struct issue *ie,
                }
        }
 
-       if (ie->mem_sz)
+       if (ie->mem_sz && ie->mem)
                write_all(STDOUT_FILENO, ie->mem, ie->mem_sz);
 
        if (ie->do_tcrestore) {