add: if (j == *argc) { break; }
context: GetCommandForPid(int pid, char ***argv, int *argc){    char buf[1024];    FILE *fPtr;    int count, i, j;    Bool ok= False;    sprintf(buf, "/proc/%d/cmdline", pid);    fPtr = fopen(buf, "r");    if (fPtr) {        count = read(fileno(fPtr), buf, 1024);        if (count > 0) {            buf[count] = 0;            for (i=0, *argc=0; i<count; i++) {                if (buf[i] == 0) {                    (*argc)++;                }            }            if ((*argc) == 0) {                *argv = NULL;                ok= False;            } else {                *argv = (char**) wmalloc(sizeof(char*) * (*argc));                (*argv)[0] = buf;                for (i=0, j=1; i<count; i++) {                    if (buf[i] != 0)                      continue;                    if (i < count-1) {                        (*argv)[j++] = &buf[i+1];                    }                }                ok= True;            }        }        fclose(fPtr);    }    return ok;}