Dr. Werner Fink 2011-02-08 18:56:58 +00:00 committed by Git OBS Bridge
parent fe08556bb6
commit 49b2556678
2 changed files with 82 additions and 4 deletions

View File

@ -1,4 +1,76 @@
--- .dummy
+++ .dummy 2011-02-07 12:28:48.679926259 +0000
@@ -0,0 +1 @@
+this is a dummy
--- 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);
}
}

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Feb 8 18:55:21 UTC 2011 - werner@suse.de
- Make real device comparision in killproc/checkproc to fix bnc#644171
- Also make ignore mode in checkproc work
-------------------------------------------------------------------
Mon Feb 7 13:26:19 CET 2011 - werner@novell.com