diff options
-rw-r--r-- | kexec/fs2dt.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kexec/fs2dt.c b/kexec/fs2dt.c index 98d6cb4..242a15e 100644 --- a/kexec/fs2dt.c +++ b/kexec/fs2dt.c @@ -639,6 +639,11 @@ static void putnode(void) } result = read(fd, buff, statbuf.st_size); close(fd); + if (result <= 0) { + printf("Unable to read %s, printing from purgatory is diabled\n", + filename); + goto no_debug; + } strncpy(filename, "/proc/device-tree/", MAXPATH); strncat(filename, buff, MAXPATH); strncat(filename, "/compatible", MAXPATH); @@ -661,7 +666,8 @@ static void putnode(void) goto no_debug; } result = read(fd, buff, statbuf.st_size); - if (!strcmp(buff, "hvterm1") || !strcmp(buff, "hvterm-protocol")) + if (result && (!strcmp(buff, "hvterm1") + || !strcmp(buff, "hvterm-protocol"))) my_debug = 1; close(fd); free(buff); |