diff options
| author | Aaron Barnes <[email protected]> | 2023-07-05 16:20:56 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-05 16:20:56 -0400 |
| commit | 712b6104e7399b2dd42c25b4cd788f0f36b5b39d (patch) | |
| tree | e6fb962a78b5ee6609c2a8d13cf753ffe2e98188 /src/debug.cc | |
| parent | 9eaf173e6801a6bbb0f4acd13ea064fbd3054be8 (diff) | |
| parent | 58beccb510bb892de56b466ac764f24297affebd (diff) | |
Merge branch 'dev' into fix-stats
Diffstat (limited to 'src/debug.cc')
| -rw-r--r-- | src/debug.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/debug.cc b/src/debug.cc index 29506bd..e23ffd4 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -124,7 +124,7 @@ void gpgpu_sim::gpgpu_debug() { fflush(stdout); char line[1024]; - fgets(line, 1024, stdin); + char * ptr = fgets(line, 1024, stdin); char *tok = strtok(line, " \t\n"); if (!strcmp(tok, "dp")) { @@ -136,7 +136,11 @@ void gpgpu_sim::gpgpu_debug() { fflush(stdout); } else if (!strcmp(tok, "q") || !strcmp(tok, "quit")) { printf("\nreally quit GPGPU-Sim (y/n)?\n"); - fgets(line, 1024, stdin); + ptr = fgets(line, 1024, stdin); + if(ptr == NULL ){ + printf("can't read input\n"); + exit(0); + } tok = strtok(line, " \t\n"); if (!strcmp(tok, "y")) { exit(0); |
