<div dir="ltr">Hello,<br><br>Please find below a diff that implements the abspath feature. Using the -A flag now resolves the relative paths to absolute ones.<br><br>Usage examples can be seen here :-<br><a href="https://gist.github.com/eQu1NoX/350ef0fa371aad26c7c6">https://gist.github.com/eQu1NoX/350ef0fa371aad26c7c6</a><div><br></div><div><div>diff --git a/defs.h b/defs.h</div><div>index cd9817b..d7434fe 100644</div><div>--- a/defs.h</div><div>+++ b/defs.h</div><div>@@ -563,6 +563,7 @@ extern bool count_wallclock;</div><div> extern unsigned int qflag;</div><div> extern bool not_failing_only;</div><div> extern unsigned int show_fd_path;</div><div>+extern bool show_abs_path;</div><div> extern bool hide_log_until_execve;</div><div> /* are we filtering traces based on paths? */</div><div> extern const char **paths_selected;</div><div>@@ -625,10 +626,10 @@ extern void get_regs(pid_t pid);</div><div> # define clear_regs()  ((void)0)</div><div> # define get_regs(pid) ((void)0)</div><div> #endif</div><div>-extern int umoven(struct tcb *, long, int, char *);</div><div>+extern int umoven(struct tcb *, long, unsigned int, char *);</div><div> #define umove(pid, addr, objp)<span class="" style="white-space:pre">     </span>\</div><div> <span class="" style="white-space:pre">        </span>umoven((pid), (addr), sizeof(*(objp)), (char *) (objp))</div><div>-extern int umovestr(struct tcb *, long, int, char *);</div><div>+extern int umovestr(struct tcb *, long, unsigned int, char *);</div><div> extern int upeek(int pid, long, long *);</div><div> #if defined(SPARC) || defined(SPARC64) || defined(IA64) || defined(SH)</div><div> extern long getrval2(struct tcb *);</div><div>@@ -679,6 +680,7 @@ extern void printstr(struct tcb *, long, long);</div><div> extern void printnum(struct tcb *, long, const char *);</div><div> extern void printnum_int(struct tcb *, long, const char *);</div><div> extern void printpath(struct tcb *, long);</div><div>+extern void printpathat(struct tcb *, int, long);</div><div> extern void printpathn(struct tcb *, long, unsigned int);</div><div> #define TIMESPEC_TEXT_BUFSIZE (sizeof(long)*3 * 2 + sizeof("{%u, %u}"))</div><div> #define TIMEVAL_TEXT_BUFSIZE  TIMESPEC_TEXT_BUFSIZE</div><div>diff --git a/file.c b/file.c</div><div>index c2bf6d3..6bff088 100644</div><div>--- a/file.c</div><div>+++ b/file.c</div><div>@@ -283,7 +283,10 @@ static int</div><div> decode_open(struct tcb *tcp, int offset)</div><div> {</div><div> <span class="" style="white-space:pre">  </span>if (entering(tcp)) {</div><div>-<span class="" style="white-space:pre">              </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>if (offset == 1)</div><div>+<span class="" style="white-space:pre">                  </span>printpathat(tcp, tcp->u_arg[offset-1], tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">         </span>else</div><div>+<span class="" style="white-space:pre">                      </span>printpath(tcp, tcp->u_arg[offset]);</div><div> <span class="" style="white-space:pre">           </span>tprints(", ");</div><div> <span class="" style="white-space:pre">         </span>/* flags */</div><div> <span class="" style="white-space:pre">              </span>tprint_open_modes(tcp->u_arg[offset + 1]);</div><div>@@ -346,7 +349,10 @@ static int</div><div> decode_access(struct tcb *tcp, int offset)</div><div> {</div><div> <span class="" style="white-space:pre"> </span>if (entering(tcp)) {</div><div>-<span class="" style="white-space:pre">              </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>if (offset == 0)</div><div>+<span class="" style="white-space:pre">                  </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>else</div><div>+<span class="" style="white-space:pre">                      </span>printpathat(tcp, tcp->u_arg[offset-1], tcp->u_arg[offset]);</div><div> <span class="" style="white-space:pre">                </span>tprints(", ");</div><div> <span class="" style="white-space:pre">         </span>printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");</div><div> <span class="" style="white-space:pre">   </span>}</div><div>@@ -1184,7 +1190,7 @@ sys_newfstatat(struct tcb *tcp)</div><div> {</div><div> <span class="" style="white-space:pre">  </span>if (entering(tcp)) {</div><div> <span class="" style="white-space:pre">             </span>print_dirfd(tcp, tcp->u_arg[0]);</div><div>-<span class="" style="white-space:pre">               </span>printpath(tcp, tcp->u_arg[1]);</div><div>+<span class="" style="white-space:pre">         </span>printpathat(tcp, tcp->u_arg[0], tcp->u_arg[1]);</div><div> <span class="" style="white-space:pre">            </span>tprints(", ");</div><div> <span class="" style="white-space:pre"> </span>} else {</div><div> #ifdef POWERPC64</div><div>@@ -1424,7 +1430,10 @@ static int</div><div> decode_mkdir(struct tcb *tcp, int offset)</div><div> {</div><div> <span class="" style="white-space:pre">    </span>if (entering(tcp)) {</div><div>-<span class="" style="white-space:pre">              </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>if (offset == 0)</div><div>+<span class="" style="white-space:pre">                  </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>else</div><div>+<span class="" style="white-space:pre">                      </span>printpathat(tcp, tcp->u_arg[offset-1], tcp->u_arg[offset]);</div><div> <span class="" style="white-space:pre">                </span>tprintf(", %#lo", tcp->u_arg[offset + 1]);</div><div> <span class="" style="white-space:pre">  </span>}</div><div> <span class="" style="white-space:pre">        </span>return 0;</div><div>@@ -1460,10 +1469,10 @@ sys_linkat(struct tcb *tcp)</div><div> {</div><div> <span class="" style="white-space:pre">    </span>if (entering(tcp)) {</div><div> <span class="" style="white-space:pre">             </span>print_dirfd(tcp, tcp->u_arg[0]);</div><div>-<span class="" style="white-space:pre">               </span>printpath(tcp, tcp->u_arg[1]);</div><div>+<span class="" style="white-space:pre">         </span>printpathat(tcp, tcp->u_arg[0], tcp->u_arg[1]);</div><div> <span class="" style="white-space:pre">            </span>tprints(", ");</div><div> <span class="" style="white-space:pre">         </span>print_dirfd(tcp, tcp->u_arg[2]);</div><div>-<span class="" style="white-space:pre">               </span>printpath(tcp, tcp->u_arg[3]);</div><div>+<span class="" style="white-space:pre">         </span>printpathat(tcp, tcp->u_arg[2], tcp->u_arg[3]);</div><div> <span class="" style="white-space:pre">            </span>tprints(", ");</div><div> <span class="" style="white-space:pre">         </span>printflags(at_flags, tcp->u_arg[4], "AT_???");</div><div> <span class="" style="white-space:pre">      </span>}</div><div>@@ -1475,7 +1484,7 @@ sys_unlinkat(struct tcb *tcp)</div><div> {</div><div> <span class="" style="white-space:pre">    </span>if (entering(tcp)) {</div><div> <span class="" style="white-space:pre">             </span>print_dirfd(tcp, tcp->u_arg[0]);</div><div>-<span class="" style="white-space:pre">               </span>printpath(tcp, tcp->u_arg[1]);</div><div>+<span class="" style="white-space:pre">         </span>printpathat(tcp, tcp->u_arg[0], tcp->u_arg[1]);</div><div> <span class="" style="white-space:pre">            </span>tprints(", ");</div><div> <span class="" style="white-space:pre">         </span>printflags(at_flags, tcp->u_arg[2], "AT_???");</div><div> <span class="" style="white-space:pre">      </span>}</div><div>@@ -1489,7 +1498,7 @@ sys_symlinkat(struct tcb *tcp)</div><div> <span class="" style="white-space:pre">             </span>printpath(tcp, tcp->u_arg[0]);</div><div> <span class="" style="white-space:pre">                </span>tprints(", ");</div><div> <span class="" style="white-space:pre">         </span>print_dirfd(tcp, tcp->u_arg[1]);</div><div>-<span class="" style="white-space:pre">               </span>printpath(tcp, tcp->u_arg[2]);</div><div>+<span class="" style="white-space:pre">         </span>printpathat(tcp, tcp->u_arg[1], tcp->u_arg[2]);</div><div> <span class="" style="white-space:pre">    </span>}</div><div> <span class="" style="white-space:pre">        </span>return 0;</div><div> }</div><div>@@ -1498,7 +1507,10 @@ static int</div><div> decode_readlink(struct tcb *tcp, int offset)</div><div> {</div><div> <span class="" style="white-space:pre">       </span>if (entering(tcp)) {</div><div>-<span class="" style="white-space:pre">              </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>if (offset == 0)</div><div>+<span class="" style="white-space:pre">                  </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>else</div><div>+<span class="" style="white-space:pre">                      </span>printpathat(tcp, tcp->u_arg[offset-1], tcp->u_arg[offset]);</div><div> <span class="" style="white-space:pre">                </span>tprints(", ");</div><div> <span class="" style="white-space:pre"> </span>} else {</div><div> <span class="" style="white-space:pre">         </span>if (syserror(tcp))</div><div>@@ -1535,10 +1547,10 @@ static void</div><div> decode_renameat(struct tcb *tcp)</div><div> {</div><div> <span class="" style="white-space:pre">  </span>print_dirfd(tcp, tcp->u_arg[0]);</div><div>-<span class="" style="white-space:pre">       </span>printpath(tcp, tcp->u_arg[1]);</div><div>+<span class="" style="white-space:pre"> </span>printpathat(tcp, tcp->u_arg[0], tcp->u_arg[1]);</div><div> <span class="" style="white-space:pre">    </span>tprints(", ");</div><div> <span class="" style="white-space:pre"> </span>print_dirfd(tcp, tcp->u_arg[2]);</div><div>-<span class="" style="white-space:pre">       </span>printpath(tcp, tcp->u_arg[3]);</div><div>+<span class="" style="white-space:pre"> </span>printpathat(tcp, tcp->u_arg[2], tcp->u_arg[3]);</div><div> }</div><div><br></div><div> int</div><div>@@ -1579,7 +1591,7 @@ sys_fchownat(struct tcb *tcp)</div><div> {</div><div> <span class="" style="white-space:pre"> </span>if (entering(tcp)) {</div><div> <span class="" style="white-space:pre">             </span>print_dirfd(tcp, tcp->u_arg[0]);</div><div>-<span class="" style="white-space:pre">               </span>printpath(tcp, tcp->u_arg[1]);</div><div>+<span class="" style="white-space:pre">         </span>printpathat(tcp, tcp->u_arg[0], tcp->u_arg[1]);</div><div> <span class="" style="white-space:pre">            </span>printuid(", ", tcp->u_arg[2]);</div><div> <span class="" style="white-space:pre">              </span>printuid(", ", tcp->u_arg[3]);</div><div> <span class="" style="white-space:pre">              </span>tprints(", ");</div><div>@@ -1603,7 +1615,10 @@ static int</div><div> decode_chmod(struct tcb *tcp, int offset)</div><div> {</div><div> <span class="" style="white-space:pre">     </span>if (entering(tcp)) {</div><div>-<span class="" style="white-space:pre">              </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>if (offset == 0)</div><div>+<span class="" style="white-space:pre">                  </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>else</div><div>+<span class="" style="white-space:pre">                      </span>printpathat(tcp, tcp->u_arg[offset-1], tcp->u_arg[offset]);</div><div> <span class="" style="white-space:pre">                </span>tprintf(", %#lo", tcp->u_arg[offset + 1]);</div><div> <span class="" style="white-space:pre">  </span>}</div><div> <span class="" style="white-space:pre">        </span>return 0;</div><div>@@ -1650,7 +1665,10 @@ static int</div><div> decode_utimes(struct tcb *tcp, int offset, int special)</div><div> {</div><div> <span class="" style="white-space:pre">      </span>if (entering(tcp)) {</div><div>-<span class="" style="white-space:pre">              </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>if (offset == 0)</div><div>+<span class="" style="white-space:pre">                  </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>else</div><div>+<span class="" style="white-space:pre">                      </span>printpathat(tcp, tcp->u_arg[offset-1], tcp->u_arg[offset]);</div><div> <span class="" style="white-space:pre">                </span>tprints(", ");</div><div> <span class="" style="white-space:pre">         </span>if (tcp->u_arg[offset + 1] == 0)</div><div> <span class="" style="white-space:pre">                      </span>tprints("NULL");</div><div>@@ -1736,7 +1754,10 @@ decode_mknod(struct tcb *tcp, int offset)</div><div> <span class="" style="white-space:pre">        </span>int mode = tcp->u_arg[offset + 1];</div><div><br></div><div> <span class="" style="white-space:pre">   </span>if (entering(tcp)) {</div><div>-<span class="" style="white-space:pre">              </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>if (offset == 0)</div><div>+<span class="" style="white-space:pre">                  </span>printpath(tcp, tcp->u_arg[offset]);</div><div>+<span class="" style="white-space:pre">            </span>else</div><div>+<span class="" style="white-space:pre">                      </span>printpathat(tcp, tcp->u_arg[offset-1], tcp->u_arg[offset]);</div><div> <span class="" style="white-space:pre">                </span>tprintf(", %s", sprintmode(mode));</div><div> <span class="" style="white-space:pre">             </span>switch (mode & S_IFMT) {</div><div> <span class="" style="white-space:pre">             </span>case S_IFCHR:</div><div>diff --git a/strace.1 b/strace.1</div><div>index 1e69217..773ead5 100644</div><div>--- a/strace.1</div><div>+++ b/strace.1</div><div>@@ -205,6 +205,9 @@ Here the second argument represents the full set of all signals.</div><div> .SH OPTIONS</div><div> .TP 12</div><div> .TP</div><div>+.B \-A</div><div>+Print absolute paths instead of relative paths everywhere.</div><div>+.TP</div><div> .B \-c</div><div> Count time, calls, and errors for each system call and report a summary on</div><div> program exit.  On Linux, this attempts to show system time (CPU time spent</div><div>diff --git a/strace.c b/strace.c</div><div>index cb96758..e70849e 100644</div><div>--- a/strace.c</div><div>+++ b/strace.c</div><div>@@ -1,4 +1,4 @@</div><div>-/*</div><div>+      /*</div><div>  * Copyright (c) 1991, 1992 Paul Kranenburg <<a href="mailto:pk@cs.few.eur.nl">pk@cs.few.eur.nl</a>></div><div>  * Copyright (c) 1993 Branko Lankester <<a href="mailto:branko@hacktic.nl">branko@hacktic.nl</a>></div><div>  * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <<a href="mailto:jrs@world.std.com">jrs@world.std.com</a>></div><div>@@ -130,6 +130,7 @@ bool not_failing_only = 0;</div><div><br></div><div> /* Show path associated with fd arguments */</div><div> unsigned int show_fd_path = 0;</div><div>+bool show_abs_path = 0;</div><div><br></div><div> static bool detach_on_execve = 0;</div><div> /* Are we "strace PROG" and need to skip detach on first execve? */</div><div>@@ -203,6 +204,7 @@ usage: strace [-CdffhiqrtttTvVxxy] [-I n] [-e expr]...\n\</div><div>               -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]\n\</div><div>    or: strace -c[df] [-I n] [-e expr]... [-O overhead] [-S sortby]\n\</div><div>               -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]\n\</div><div>+-A -- print absolute paths instead of relative paths everywhere\n\</div><div> -c -- count time, calls, and errors for each syscall and report summary\n\</div><div> -C -- like -c but also print regular output\n\</div><div> -w -- summarise syscall latency (default is system time)\n\</div><div>@@ -1678,9 +1680,13 @@ init(int argc, char *argv[])</div><div> #ifdef USE_LIBUNWIND</div><div> <span class="" style="white-space:pre">               </span>"k"</div><div> #endif</div><div>+<span class="" style="white-space:pre">              </span>"A"</div><div> <span class="" style="white-space:pre">            </span>"D"</div><div> <span class="" style="white-space:pre">            </span>"a:e:o:O:p:s:S:u:E:P:I:")) != EOF) {</div><div> <span class="" style="white-space:pre">           </span>switch (c) {</div><div>+<span class="" style="white-space:pre">              </span>case 'A':</div><div>+<span class="" style="white-space:pre">                 </span>show_abs_path = 1;</div><div>+<span class="" style="white-space:pre">                        </span>break;</div><div> <span class="" style="white-space:pre">           </span>case 'b':</div><div> <span class="" style="white-space:pre">                        </span>if (strcmp(optarg, "execve") != 0)</div><div> <span class="" style="white-space:pre">                             </span>error_msg_and_die("Syscall '%s' for -b isn't supported",</div><div>diff --git a/util.c b/util.c</div><div>index 4e62a8a..c3224a9 100644</div><div>--- a/util.c</div><div>+++ b/util.c</div><div>@@ -422,6 +422,11 @@ void</div><div> printfd(struct tcb *tcp, int fd)</div><div> {</div><div> <span class="" style="white-space:pre">   </span>char path[PATH_MAX + 1];</div><div>+</div><div>+<span class="" style="white-space:pre">  </span>if (show_fd_path &&</div><div>+<span class="" style="white-space:pre">       </span>    getfdpath(tcp, fd, path, sizeof(path)) >= 0)</div><div>+<span class="" style="white-space:pre">             </span>tprintf("%d<%s>", fd, path);</div><div>+<span class="" style="white-space:pre">      </span>else</div><div> <span class="" style="white-space:pre">     </span>if (show_fd_path && getfdpath(tcp, fd, path, sizeof(path)) >= 0) {</div><div> <span class="" style="white-space:pre">            </span>static const char socket_prefix[] = "socket:[";</div><div> <span class="" style="white-space:pre">                </span>const size_t socket_prefix_len = sizeof(socket_prefix) - 1;</div><div>@@ -592,11 +597,64 @@ string_quote(const char *instr, char *outstr, long len, int size)</div><div> }</div><div><br></div><div> /*</div><div>- * Print path string specified by address `addr' and length `n'.</div><div>- * If path length exceeds `n', append `...' to the output.</div><div>+ * Encode a path(either cwd or fd path) in a manner fit for printing</div><div>+ * before a relative path.</div><div>  */</div><div>+static void</div><div>+encode_path(char *path, int n)</div><div>+{</div><div>+<span class="" style="white-space:pre">     </span>char *outstr;</div><div>+</div><div>+<span class="" style="white-space:pre">     </span>path[n++] = '/';</div><div>+<span class="" style="white-space:pre">  </span>path[n++] = '\0';</div><div>+</div><div>+<span class="" style="white-space:pre"> </span>/* path has n-1 characters followed by a null */</div><div>+<span class="" style="white-space:pre">  </span>outstr = alloca(4 * n); /* 4*(n-1) + 3 for quotes and NUL */</div><div>+<span class="" style="white-space:pre">      </span>string_quote(path, outstr, -1, n);</div><div>+<span class="" style="white-space:pre">        </span>outstr[strlen(outstr)-1] = '\0'; /* Don't print the closing quotes */</div><div>+<span class="" style="white-space:pre"> </span>tprints(outstr);</div><div>+}</div><div>+</div><div>+/*</div><div>+ * Print the current working directory of the tracee process</div><div>+ */</div><div>+static bool</div><div>+print_tracee_cwd(struct tcb *tcp)</div><div>+{</div><div>+<span class="" style="white-space:pre">   </span>int link_size = sizeof("/proc//cwd") + sizeof(int) * 3;</div><div>+<span class="" style="white-space:pre"> </span>char linkpath[link_size];</div><div>+<span class="" style="white-space:pre"> </span>char cwd[MAXPATHLEN + 2];</div><div>+<span class="" style="white-space:pre"> </span>ssize_t n;</div><div>+</div><div>+<span class="" style="white-space:pre">        </span>snprintf(linkpath, link_size, "/proc/%u/cwd", tcp->pid);</div><div>+<span class="" style="white-space:pre">     </span>n = readlink(linkpath, cwd, MAXPATHLEN);</div><div>+</div><div>+<span class="" style="white-space:pre">  </span>if (n > 0) {</div><div>+<span class="" style="white-space:pre">           </span>encode_path(cwd, n);</div><div>+<span class="" style="white-space:pre">              </span>return true;</div><div>+<span class="" style="white-space:pre">      </span>}</div><div>+<span class="" style="white-space:pre"> </span>return false;</div><div>+}</div><div>+</div><div>+/*</div><div>+ * Print absolute path string corresponding to an `fd`.</div><div>+ */</div><div>+static bool</div><div>+print_tracee_fdpath(struct tcb *tcp, int fd)</div><div>+{</div><div>+<span class="" style="white-space:pre">        </span>char path[PATH_MAX + 1];</div><div>+<span class="" style="white-space:pre">  </span>int n;</div><div>+</div><div>+<span class="" style="white-space:pre">    </span>n = getfdpath(tcp, fd, path, sizeof(path));</div><div>+<span class="" style="white-space:pre">       </span>if (n > 0) {</div><div>+<span class="" style="white-space:pre">           </span>encode_path(path, n);</div><div>+<span class="" style="white-space:pre">             </span>return true;</div><div>+<span class="" style="white-space:pre">      </span>}</div><div>+<span class="" style="white-space:pre"> </span>return false;</div><div>+}</div><div>+</div><div> void</div><div>-printpathn(struct tcb *tcp, long addr, unsigned int n)</div><div>+printpath_common(struct tcb *tcp, int fd, long addr, unsigned int n)</div><div> {</div><div> <span class="" style="white-space:pre">  </span>char path[MAXPATHLEN + 1];</div><div> <span class="" style="white-space:pre">       </span>int nul_seen;</div><div>@@ -616,11 +674,30 @@ printpathn(struct tcb *tcp, long addr, unsigned int n)</div><div> <span class="" style="white-space:pre">         </span>tprintf("%#lx", addr);</div><div> <span class="" style="white-space:pre"> </span>else {</div><div> <span class="" style="white-space:pre">           </span>char *outstr;</div><div>+<span class="" style="white-space:pre">             </span>bool prefix_printed = false;</div><div><br></div><div> <span class="" style="white-space:pre">            </span>path[n] = '\0';</div><div>+</div><div>+<span class="" style="white-space:pre">           </span>/* If the path prefix of a relative path does not depend</div><div>+<span class="" style="white-space:pre">          </span> * on an fd */</div><div>+<span class="" style="white-space:pre">            </span>if (fd == -1 && show_abs_path && *path && *path != '/')</div><div>+<span class="" style="white-space:pre">                   </span>prefix_printed = print_tracee_cwd(tcp);</div><div>+</div><div>+<span class="" style="white-space:pre">           </span>/* If path prefix of a relative path depends on the fd */</div><div>+<span class="" style="white-space:pre">         </span>else if (show_abs_path && *path && *path != '/') {</div><div>+<span class="" style="white-space:pre">                        </span>if (fd == AT_FDCWD)</div><div>+<span class="" style="white-space:pre">                               </span>prefix_printed = print_tracee_cwd(tcp);</div><div>+<span class="" style="white-space:pre">                   </span>else</div><div>+<span class="" style="white-space:pre">                              </span>prefix_printed = print_tracee_fdpath(tcp, fd);</div><div>+<span class="" style="white-space:pre">            </span>}</div><div>+</div><div> <span class="" style="white-space:pre">                </span>n++;</div><div> <span class="" style="white-space:pre">             </span>outstr = alloca(4 * n); /* 4*(n-1) + 3 for quotes and NUL */</div><div> <span class="" style="white-space:pre">             </span>string_quote(path, outstr, -1, n);</div><div>+</div><div>+<span class="" style="white-space:pre">                </span>/* Dont print opening quotes if cwd/decoded dirfd is printed */</div><div>+<span class="" style="white-space:pre">           </span>if (prefix_printed)</div><div>+<span class="" style="white-space:pre">                       </span>outstr += 1;</div><div> <span class="" style="white-space:pre">             </span>tprints(outstr);</div><div> <span class="" style="white-space:pre">         </span>if (!nul_seen)</div><div> <span class="" style="white-space:pre">                   </span>tprints("...");</div><div>@@ -628,6 +705,18 @@ printpathn(struct tcb *tcp, long addr, unsigned int n)</div><div> }</div><div><br></div><div> void</div><div>+printpathat(struct tcb *tcp, int fd, long addr)</div><div>+{</div><div>+<span class="" style="white-space:pre">       </span>printpath_common(tcp, fd, addr, MAXPATHLEN);</div><div>+}</div><div>+</div><div>+void</div><div>+printpathn(struct tcb *tcp, long addr, unsigned int n)</div><div>+{</div><div>+<span class="" style="white-space:pre">  </span>printpath_common(tcp, -1, addr, n);</div><div>+}</div><div>+</div><div>+void</div><div> printpath(struct tcb *tcp, long addr)</div><div> {</div><div> <span class="" style="white-space:pre"> </span>/* Size must correspond to char path[] size in printpathn */</div><div>@@ -864,7 +953,7 @@ static bool process_vm_readv_not_supported = 1;</div><div>  * at address `addr' to our space at `laddr'</div><div>  */</div><div> int</div><div>-umoven(struct tcb *tcp, long addr, int len, char *laddr)</div><div>+umoven(struct tcb *tcp, long addr, unsigned int len, char *laddr)</div><div> {</div><div> <span class="" style="white-space:pre">   </span>int pid = tcp->pid;</div><div> <span class="" style="white-space:pre">   </span>int n, m, nread;</div><div>@@ -886,7 +975,7 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr)</div><div> <span class="" style="white-space:pre">              </span>remote[0].iov_base = (void*)addr;</div><div> <span class="" style="white-space:pre">                </span>local[0].iov_len = remote[0].iov_len = len;</div><div> <span class="" style="white-space:pre">              </span>r = process_vm_readv(pid, local, 1, remote, 1, 0);</div><div>-<span class="" style="white-space:pre">                </span>if (r == len)</div><div>+<span class="" style="white-space:pre">             </span>if ((unsigned int)r == len)</div><div> <span class="" style="white-space:pre">                      </span>return 0;</div><div> <span class="" style="white-space:pre">                </span>if (r >= 0) {</div><div> <span class="" style="white-space:pre">                 </span>error_msg("umoven: short read (%d < %d) @0x%lx",</div><div>@@ -985,7 +1074,7 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr)</div><div>  * we never write past laddr[len-1]).</div><div>  */</div><div> int</div><div>-umovestr(struct tcb *tcp, long addr, int len, char *laddr)</div><div>+umovestr(struct tcb *tcp, long addr, unsigned int len, char *laddr)</div><div> {</div><div> #if SIZEOF_LONG == 4</div><div> <span class="" style="white-space:pre">      </span>const unsigned long x01010101 = 0x01010101ul;</div></div><div><br></div><div><br></div><div>Thanks!</div><div>Zubin</div></div>