summaryrefslogtreecommitdiffstats
path: root/runtime/stpd/stpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/stpd/stpd.c')
-rw-r--r--runtime/stpd/stpd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/stpd/stpd.c b/runtime/stpd/stpd.c
index e99f4b47..14107664 100644
--- a/runtime/stpd/stpd.c
+++ b/runtime/stpd/stpd.c
@@ -53,6 +53,7 @@ gid_t cmd_gid;
/* relayfs base file name */
static char stpd_filebase[1024];
+#define RELAYFS_MAGIC 0xF0B4A981
/* if no output file name is specified, use this */
#define DEFAULT_OUTFILE_NAME "probe.out"
@@ -211,11 +212,11 @@ int main(int argc, char **argv)
if (!outfile_name)
outfile_name = DEFAULT_OUTFILE_NAME;
}
-
- if (statfs("/mnt/relay", &st) < 0)
- sprintf(stpd_filebase, "/proc/systemtap/stap_%d/cpu", driver_pid);
- else
+
+ if ((statfs("/mnt/relay", &st) == 0) && (st.f_type == (long) RELAYFS_MAGIC))
sprintf(stpd_filebase, "/mnt/relay/%d/cpu", getpid());
+ else
+ sprintf(stpd_filebase, "/proc/systemtap/stap_%d/cpu", driver_pid);
if (init_stp(stpd_filebase, !quiet)) {
//fprintf(stderr, "Couldn't initialize stpd. Exiting.\n");