%p template doesn't work, because it's expanding to the full path of binary
file. With this patch, %p template is expanded to the base name of binary file.

Signed-off-by: Peter Schiffer <pschi...@redhat.com>
---
 src/api.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/api.c b/src/api.c
index 0e4601b..183f387 100644
--- a/src/api.c
+++ b/src/api.c
@@ -2966,10 +2966,10 @@ int cgroup_change_cgroup_flags(uid_t uid, gid_t gid,
                                                available, "%d", pid);
                                        break;
                                case 'p':
-                                       if(procname) {
+                                       if(procname && 
strlen(basename(procname))) {
                                                written = snprintf(newdest + j,
                                                        available, "%s",
-                                                       procname);
+                                                       basename(procname));
                                        } else {
                                                written = snprintf(newdest + j,
                                                        available, "%d", pid);


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to