netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=a80d2444768b857226b2976ce42ba69168ff4454

commit a80d2444768b857226b2976ce42ba69168ff4454
Author: Alastair Poole <nets...@gmail.com>
Date:   Sat May 9 00:14:30 2020 +0100

    process: Make sure Linux always parses cmdline.
---
 src/bin/process.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/bin/process.c b/src/bin/process.c
index 72fedb3..eecf89f 100644
--- a/src/bin/process.c
+++ b/src/bin/process.c
@@ -177,29 +177,27 @@ _cmd_args(Proc_Info *p, int pid, char *name, size_t len)
         snprintf(name, len, "%s", ecore_file_file_get(link));
         free(link);
      }
-   else
+
+   FILE *f = fopen(eina_slstr_printf("/proc/%d/cmdline", pid), "r");
+   if (f)
      {
-        FILE *f = fopen(eina_slstr_printf("/proc/%d/cmdline", pid), "r");
-        if (f)
+        if (fgets(line, sizeof(line), f))
           {
-             if (fgets(line, sizeof(line), f))
-               {
-                  Eina_Strbuf *buf = eina_strbuf_new();
-                  const char *n;
+             Eina_Strbuf *buf = eina_strbuf_new();
+             const char *n;
 
-                  if (ecore_file_exists(line))
-                    snprintf(name, len, "%s", ecore_file_file_get(line));
+             if (ecore_file_exists(line))
+               snprintf(name, len, "%s", ecore_file_file_get(line));
 
-                  n = line;
-                  while (*n && (*n + 1))
-                    {
-                       eina_strbuf_append_printf(buf, "%s ", n);
-                       n = strchr(n, '\0') + 1;
-                    }
-                  p->arguments = eina_strbuf_release(buf);
+             n = line;
+             while (*n && (*n + 1))
+               {
+                 eina_strbuf_append_printf(buf, "%s ", n);
+                 n = strchr(n, '\0') + 1;
                }
-             fclose(f);
+             p->arguments = eina_strbuf_release(buf);
           }
+        fclose(f);
      }
 
    char *end = strchr(name, ' ');

-- 


Reply via email to