chiark / gitweb /
util: fix space calculation in get_process_cmdline()
authorLennart Poettering <lennart@poettering.net>
Tue, 6 Jul 2010 18:15:08 +0000 (20:15 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 6 Jul 2010 18:33:54 +0000 (20:33 +0200)
src/util.c

index 8c22dbe..d1120c6 100644 (file)
@@ -601,6 +601,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, char **line) {
                                         break;
 
                                 *(k++) = ' ';
+                                left--;
                                 space = false;
                         }
 
@@ -608,6 +609,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, char **line) {
                                 break;
 
                         *(k++) = (char) c;
+                        left--;
                 }  else
                         space = true;
         }