diff options
author | Christopher Faylor <me@cgf.cx> | 2012-04-07 21:32:44 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2012-04-07 21:32:44 +0400 |
commit | e5b7e4d1c796b0a07b3c9af7fbb8ad9d9db2f50c (patch) | |
tree | 6a3ae2bdc4a9a3d8a196b3d6fce2e1956a2ec56c /winsup/cygwin/path.cc | |
parent | 00ceaad13411f75e1a8d203e7506287e4170357f (diff) |
* dtable.cc (cygwin_attach_handle_to_fd): Defend against NULL return from
build_fh_*.
(dtable::init_std_file_from_handle): Ditto.
* mmap.cc (mmap_record::alloc_fh): Ditto.
* path.cc (path_conv::check): Ditto.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 57183da48..3524c0cc0 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -744,13 +744,19 @@ path_conv::check (const char *src, unsigned opt, { /* FIXME: Calling build_fhandler here is not the right way to handle this. */ fhandler_virtual *fh = (fhandler_virtual *) build_fh_dev (dev, path_copy); - virtual_ftype_t file_type = fh->exists (); - if (file_type == virt_symlink) + virtual_ftype_t file_type; + if (!fh) + file_type = virt_none; + else { - fh->fill_filebuf (); - symlen = sym.set (fh->get_filebuf ()); + file_type = fh->exists (); + if (file_type == virt_symlink) + { + fh->fill_filebuf (); + symlen = sym.set (fh->get_filebuf ()); + } + delete fh; } - delete fh; switch (file_type) { case virt_directory: |