Преглед на файлове

Linux ptrace(2) is returning EPERM rather than EBUSY for 'already traced'.

The EPERM check was added only for FreeBSD's sysctl. Just limit the check
to FreeBSD instead.
Bryan Drewery преди 11 години
родител
ревизия
868acbfc1a
променени са 2 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 1 0
      doc/UPDATES
  2. 5 1
      src/shell.cc

+ 1 - 0
doc/UPDATES

@@ -2,6 +2,7 @@ maint
   * Disable demo TCL support by default to prevent confusion during build.
   * Avoid apparmor ptrace(2) warnings on Ubuntu
   * Allow 'set trace ignore' again. Undoes a change from 2005.
+  * Fix ptrace detection on Linux
 
 1.4.5
   * Remove ahbl as it now positively identifies all hosts as abusive

+ 5 - 1
src/shell.cc

@@ -321,8 +321,12 @@ void check_trace(int start)
           ;
 
         i = ptrace(PT_ATTACH, parent, 0, 0);
+        if (i == -1 &&
         /* EPERM is given on fbsd when security.bsd.unprivileged_proc_debug=0 */
-        if (i == -1 && errno != EPERM && errno != EINVAL) {
+#ifdef __FreeBSD__
+            errno != EPERM &&
+#endif
+            errno != EINVAL) {
           if (start) {
             kill(parent, SIGKILL);
             exit(1);