monitor: Fix file_completion() to check for stat() failure
authorMarkus Armbruster <armbru@redhat.com>
Wed, 16 Nov 2011 14:43:47 +0000 (15:43 +0100)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Thu, 17 Nov 2011 12:57:49 +0000 (12:57 +0000)
commitf49a524e3d49b0fd7fb8993c1d7570c107c93cca
tree3fb2ec211e17e11476872061d70a7056b72ba8d2
parent87a2e775090fa0100d47f020d3ef154bb11fdfdc
monitor: Fix file_completion() to check for stat() failure

stat() can fail for a file name just read with readdir().  Easiest way
to trigger is a dangling symbolic link --- look ma, no race!  When it
fails, file_completion() uses sb.st_mode uninitialized.  If the
directory bit happens to be set, it appends a "/" to the completed
name.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
monitor.c