diff options
| author | Tor Aamodt <[email protected]> | 2025-02-10 17:35:31 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-02-10 17:35:31 -0800 |
| commit | 0e39753a623978eb37bf044b21fde1a5909bff03 (patch) | |
| tree | 13416ab3a165dde580fe847b06bde7c966482088 /src/debug.cc | |
| parent | 6b244a5d3be7811f16c312905c1c7fee137ac7a4 (diff) | |
| parent | 48af0c94ca6d7b05f800f535b3de4cefafcfa655 (diff) | |
Merge pull request #313 from accel-sim/dev
Purdue Updates Merging
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..8cc5e1f 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); |
