Browse Source

Don't crash at startup if ptrace(2) is ENOSYS

Bryan Drewery 10 years ago
parent
commit
5dfdcfafe2
2 changed files with 3 additions and 0 deletions
  1. 1 0
      doc/UPDATES.md
  2. 2 0
      src/shell.cc

+ 1 - 0
doc/UPDATES.md

@@ -1,5 +1,6 @@
 # maint
   * Update server list, 'set -yes servers -' and 'set -yes servers6 -' to get new list.
+  * Fix binary compat on FreeBSD due to lack of ptrace(2).
 
 # 1.4.6
   * Disable demo TCL support by default to prevent confusion during build.

+ 2 - 0
src/shell.cc

@@ -322,6 +322,8 @@ void check_trace(int start)
 
         i = ptrace(PT_ATTACH, parent, 0, 0);
         if (i == -1 &&
+            /* Linux compat or otherwise removed syscall. Just ignore. */
+            errno != ENOSYS &&
         /* EPERM is given on fbsd when security.bsd.unprivileged_proc_debug=0 */
 #ifdef __FreeBSD__
             errno != EPERM &&