Cygwin: pinfo: use stpcpy where appropriate
[newlib-cygwin.git] / winsup / cygwin / fhandler / dev_fd.cc
blob96ebd85ea7219e30aead97ad74b13d5079d948cf
1 /* fhandler_process_fd.cc: fhandler for the /dev/{fd,std{in,out,err}} symlinks
3 This file is part of Cygwin.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
7 details. */
9 #include "winsup.h"
10 #include "path.h"
11 #include "fhandler.h"
13 fhandler_dev_fd::fhandler_dev_fd ():
14 fhandler_virtual ()
18 virtual_ftype_t
19 fhandler_dev_fd::exists ()
21 return virt_symlink;
24 int
25 fhandler_dev_fd::fstat (struct stat *buf)
27 const char *path = get_name ();
28 debug_printf ("fstat (%s)", path);
30 fhandler_base::fstat (buf);
32 buf->st_mode = S_IFLNK | STD_RBITS | S_IWUSR | S_IWGRP | S_IWOTH | STD_XBITS;
33 buf->st_ino = get_ino ();
35 return 0;
38 bool
39 fhandler_dev_fd::fill_filebuf ()
41 const char *path = get_name ();
42 debug_printf ("fill_filebuf (%s)", path);
44 const char *native = get_native_name ();
45 if (!native)
47 return false;
50 free(filebuf);
51 filebuf = cstrdup (native);
52 return true;