Notes
This function is in beta test. Please help improve it in the issues
here.
pwd: /out/package ppid: 82643 1: WRITELN sleep 10 2: CTRL+C Scan child pids of ppid: 82643 SIGINT Send signal 2 to pid: 82643 Scan child pids of ppid: 82644 Send signal 2 to pid: 82644 Scan child pids of ppid: 82645 Send signal 2 to pid: 82645 Scan child pids of ppid: 82646 Send signal 2 to pid: 82646 3: WRITELN echo 123 > 1.txt 4: WRITELN sleep 10 > 1.txt 5: CTRL+C Scan child pids of ppid: 82643 SIGINT Send signal 2 to pid: 82643 Scan child pids of ppid: 82644 Send signal 2 to pid: 82644 Scan child pids of ppid: 82645 Send signal 2 to pid: 82645 Scan child pids of ppid: 82652 Send signal 2 to pid: 82652 6: WRITELN cat 1.txt 7: WRITELN echo success 8: CTRL+C Scan child pids of ppid: 82643 SIGINT Send signal 2 to pid: 82643 Scan child pids of ppid: 82644 Send signal 2 to pid: 82644 Scan child pids of ppid: 82645 Send signal 2 to pid: 82645 Scan child pids of ppid: 82658 Send signal 2 to pid: 82658 9: WRITELN exit exit: 1
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
mumsh $ mumsh $ ================================================================= ==82650==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6140000003d0 at pc 0x000000515a81 bp 0x7fff1e2ec5e0 sp 0x7fff1e2ec5d8 READ of size 8 at 0x6140000003d0 thread T0 #0 0x515a80 (/out/package/mumsh_memory_check+0x515a80) #1 0x515f6f (/out/package/mumsh_memory_check+0x515f6f) #2 0x516dad (/out/package/mumsh_memory_check+0x516dad) #3 0x5172f9 (/out/package/mumsh_memory_check+0x5172f9) #4 0x7f9f3fba4b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #5 0x41cd09 (/out/package/mumsh_memory_check+0x41cd09) 0x6140000003d0 is located 0 bytes to the right of 400-byte region [0x614000000240,0x6140000003d0) allocated by thread T0 here: #0 0x4dcbc0 (/out/package/mumsh_memory_check+0x4dcbc0) #1 0x517119 (/out/package/mumsh_memory_check+0x517119) #2 0x7f9f3fba4b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) SUMMARY: AddressSanitizer: heap-buffer-overflow (/out/package/mumsh_memory_check+
JOJ Answer
mumsh $ mumsh $ mumsh $ mumsh $ mumsh $ success mumsh $ mumsh $ exit