77 lines
1.9 KiB
Plaintext
77 lines
1.9 KiB
Plaintext
--- checkproc.c
|
|
+++ checkproc.c 2011-02-08 18:49:40.991925970 +0000
|
|
@@ -210,6 +210,8 @@ int main(int argc, char **argv)
|
|
if (pid_file) { /* The case of having a pid file */
|
|
if (verify_pidfile(pid_file,fullname,root,flags,false) < 0)
|
|
exit(LSB_STATUS_PROOFX);
|
|
+ if (iargc)
|
|
+ clear_pids();
|
|
}
|
|
if (list_empty(&remember)) { /* No process found with pid file */
|
|
if (pid_forced)
|
|
--- libinit.c
|
|
+++ libinit.c 2011-02-08 18:30:50.260425424 +0000
|
|
@@ -314,9 +314,42 @@ static void init_mounts(void)
|
|
join(&save, &mounts);
|
|
}
|
|
|
|
+static MNTINFO *find_prefix(const char * path, const dev_t dev)
|
|
+{
|
|
+ const size_t nlen = strlen(path);
|
|
+ list_t *ptr;
|
|
+
|
|
+ list_for_each(ptr, &mounts) {
|
|
+ MNTINFO *m = list_entry(ptr, MNTINFO);
|
|
+ if (m->dev != dev)
|
|
+ continue;
|
|
+ if (nlen < m->nlen)
|
|
+ continue;
|
|
+ if (m->nlen > 1 && path[m->nlen] != '\0' && path[m->nlen] != '/')
|
|
+ continue;
|
|
+ if (strncmp(path, m->point, m->nlen))
|
|
+ continue;
|
|
+ return m;
|
|
+ }
|
|
+ return (MNTINFO*)0;
|
|
+}
|
|
+
|
|
static int find_mount(const char * path, MNTINFO *s)
|
|
{
|
|
- return (strncmp(path, s->point, s->nlen) == 0);
|
|
+ const size_t nlen = strlen(path);
|
|
+ list_t *ptr;
|
|
+
|
|
+ list_for_each(ptr, &mounts) {
|
|
+ MNTINFO *m = list_entry(ptr, MNTINFO);
|
|
+ if (nlen < m->nlen)
|
|
+ continue;
|
|
+ if (m->nlen > 1 && path[m->nlen] != '\0' && path[m->nlen] != '/')
|
|
+ continue;
|
|
+ if (strncmp(path, m->point, m->nlen))
|
|
+ continue;
|
|
+ return (m == s);
|
|
+ }
|
|
+ return 0;
|
|
}
|
|
|
|
extern inline char * handl_buf(char *restrict buf)
|
|
@@ -661,17 +694,8 @@ int pidof (const char * inname, const ch
|
|
}
|
|
realname = expandpath(fullname);
|
|
if (realname) {
|
|
- list_t *ptr;
|
|
init_mounts();
|
|
- list_for_each(ptr, &mounts) {
|
|
- MNTINFO *m = list_entry(ptr, MNTINFO);
|
|
- if (m->dev != full_st.st_dev)
|
|
- continue;
|
|
- if (strncmp(realname, m->point, m->nlen) != 0)
|
|
- continue;
|
|
- prefix = m;
|
|
- break;
|
|
- }
|
|
+ prefix = find_prefix(realname, full_st.st_dev);
|
|
}
|
|
}
|
|
|