}
}
+ /* AIX has DMAPI but no POSIX capablities support. In this case,
+ * we need to be root to do DMAPI manipulations.
+ */
+#ifndef HAVE_POSIX_CAPABILITIES
+ become_root();
+#endif
+
err = dm_path_to_handle(CONST_DISCARD(char *, path),
&dm_handle, &dm_handle_len);
if (err < 0) {
path, strerror(errno)));
if (errno != EPERM) {
- return 0;
+ goto done;
}
/* Linux capabilities are broken in that changing our
DEBUG(DMAPI_TRACE,
("retrying dm_path_to_handle(%s): %s\n",
path, strerror(errno)));
- return 0;
+ goto done;
}
}
DEBUG(DMAPI_TRACE, ("dm_get_eventlist(%s): %s\n",
path, strerror(errno)));
dm_handle_free(dm_handle, dm_handle_len);
- return 0;
+ goto done;
}
/* We figure that the only reason a DMAPI application would be
DEBUG(DMAPI_TRACE, ("%s is OFFLINE\n", path));
}
+done:
+
+#ifndef HAVE_POSIX_CAPABILITIES
+ unbecome_root();
+#endif
+
return flags;
}