Hello Robert, On 11/17/20 4:24 PM, Robert Kumanek wrote: > Hi Michael Kerrisk, > > I have run the solution bad_longjmp.c from tlpi-repo and I found it ends > with seg_fault. It's good, but next I commented partly source code, i.e. > definition of recur() and its call in main and then after recompilation and > running it ends also with seg_fault. So I think it was enough to use the > example without recur(). Maybe I am wrong and it showed something I missed, > if yes, than what was intention of recur? > > Best wishes and big respect for your work, It's been a long time since I wrote that program, and nearly as long since I last tested it, and my memory is a little hazy. My suspicion is that things have changed (i.e., the compiler is generating different code these days), with the result that the second kind of setjmp() error that was shown by this code no longer happens. If I recall correctly, when the recur() code path was executed (i.e., a command-line argument was supplied to the program), then the longjmp() took us back to one of the still pristine stack frames from one of the recur() calls, and the program printed out messages saying that it was now exiting recur() (again), and *then* crashed. But, that no longer happens. So, you're right that the recur() code no longer serves any purpose, and I think I will just delete it. Thanks for letting me know about this, and I hope you continue enjoying the book. Cheers, Michael -- Michael Kerrisk, man7.org Training and Consulting mtk@xxxxxxxx, http://man7.org/training/ "The Linux Programming Interface" -- http://man7.org/tlpi/