+
+GSList* obt_paths_autostart_dirs(ObtPaths *p)
+{
+ return p->autostart_dirs;
+}
+
+static inline gboolean try_exec(const ObtPaths *const p,
+ const gchar *const path)
+{
+ struct stat st;
+ BSEARCH_SETUP();
+
+ if (stat(path, &st) != 0)
+ return FALSE;
+
+ if (!S_ISREG(st.st_mode))
+ return FALSE;
+ if (st.st_uid == p->uid)
+ return st.st_mode & S_IXUSR;
+ BSEARCH(guint, p->gid, 0, p->n_gid, st.st_gid);
+ if (BSEARCH_FOUND())
+ return st.st_mode & S_IXGRP;
+ return st.st_mode & S_IXOTH;
+}
+
+gboolean obt_paths_try_exec(ObtPaths *p, const gchar *path)
+{
+ if (path[0] == '/') {
+ return try_exec(p, path);
+ }
+ else {
+ GSList *it;
+
+ for (it = p->exec_dirs; it; it = g_slist_next(it)) {
+ gchar *f = g_build_filename(it->data, path, NULL);
+ gboolean e = try_exec(p, f);
+ g_free(f);
+ if (e) return TRUE;
+ }
+ }
+
+ return FALSE;
+}