diff options
author | hunt <hunt> | 2007-09-14 17:32:14 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-09-14 17:32:14 +0000 |
commit | ce54f2e24706f55975a945542662b0e7280e483e (patch) | |
tree | 4438213d9bd681eb8e6a53a4848be16bc29c9777 /runtime/procfs.c | |
parent | 62d05fd6924b86fa27f3d73ce62d978e51eb09ed (diff) | |
download | systemtap-steved-ce54f2e24706f55975a945542662b0e7280e483e.tar.gz systemtap-steved-ce54f2e24706f55975a945542662b0e7280e483e.tar.xz systemtap-steved-ce54f2e24706f55975a945542662b0e7280e483e.zip |
2007-09-14 Martin Hunt <hunt@redhat.com>
* procfs.c (_stp_create_procfs): Be sure that directories in the path
are really directories and not files.
Diffstat (limited to 'runtime/procfs.c')
-rw-r--r-- | runtime/procfs.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/runtime/procfs.c b/runtime/procfs.c index d4f8ddbe..31cb3bee 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -89,7 +89,7 @@ done: /* * This checks our local cache to see if we already made the dir. */ -static struct proc_dir_entry *_stp_procfs_dir_lookup(const char *dir, struct proc_dir_entry *parent) +static struct proc_dir_entry *_stp_procfs_lookup(const char *dir, struct proc_dir_entry *parent) { int i; for (i = 0; i <_stp_num_pde; i++) { @@ -111,7 +111,7 @@ int _stp_create_procfs(const char *path, int num) num, STP_MAX_PROCFS_FILES); return -1; } - + _stp_mkdir_proc_module(); last_dir = _stp_proc_root; @@ -125,19 +125,24 @@ int _stp_create_procfs(const char *path, int num) if (_stp_num_pde == STP_MAX_PROCFS_FILES) goto too_many; *next = 0; - de = _stp_procfs_dir_lookup(p, last_dir); + de = _stp_procfs_lookup(p, last_dir); if (de == NULL) { last_dir = proc_mkdir(p, last_dir); + _dbug("mkdir of %s returned %p\n", p, last_dir); if (!last_dir) { - _stp_error("Could not create directory \"%s\" " \ - "in path \"%s\"\n", p, path); + _stp_error("Could not create directory \"%s\"\n", p); goto err; } _stp_pde[_stp_num_pde++] = last_dir; last_dir->uid = _stp_uid; last_dir->gid = _stp_gid; - } else + } else { + if (!S_ISDIR(de->mode)) { + _stp_error("Could not create directory \"%s\"\n", p); + goto err; + } last_dir = de; + } p = next + 1; } |