2004-04-14 Pierre Humblet <pierre.humblet@ieee.org>

* path.h (path_conv::set_symlink): Add argument.
        (path_conv::get_symlink_length): New method.
        (path_conv::symlink_length): New member.
        * path.cc (path_conv::check): Pass symlen to set_symlink.
        * fhandler_disk_file.cc (fhandler_base::fstat_helper): For symlinks
        set st_size from get_symlink_length.
This commit is contained in:
Pierre Humblet 2004-04-14 03:08:00 +00:00
parent 3614afe6a0
commit b923181eca
4 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2004-04-14 Pierre Humblet <pierre.humblet@ieee.org>
* path.h (path_conv::set_symlink): Add argument.
(path_conv::get_symlink_length): New method.
(path_conv::symlink_length): New member.
* path.cc (path_conv::check): Pass symlen to set_symlink.
* fhandler_disk_file.cc (fhandler_base::fstat_helper): For symlinks
set st_size from get_symlink_length.
2004-04-13 Corinna Vinschen <corinna@vinschen.de> 2004-04-13 Corinna Vinschen <corinna@vinschen.de>
* security.cc (set_nt_attribute): Only call get_nt_object_security * security.cc (set_nt_attribute): Only call get_nt_object_security

View File

@ -282,6 +282,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
buf->st_mode = S_IFDIR; buf->st_mode = S_IFDIR;
else if (pc.issymlink ()) else if (pc.issymlink ())
{ {
buf->st_size = pc.get_symlink_length ();
/* symlinks are everything for everyone! */ /* symlinks are everything for everyone! */
buf->st_mode = S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO; buf->st_mode = S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO;
get_file_attribute (pc.has_acls (), get_io_handle (), get_win32_name (), get_file_attribute (pc.has_acls (), get_io_handle (), get_win32_name (),

View File

@ -705,7 +705,7 @@ path_conv::check (const char *src, unsigned opt,
saw_symlinks = 1; saw_symlinks = 1;
if (component == 0 && !need_directory && !(opt & PC_SYM_FOLLOW)) if (component == 0 && !need_directory && !(opt & PC_SYM_FOLLOW))
{ {
set_symlink (); // last component of path is a symlink. set_symlink (symlen); // last component of path is a symlink.
if (opt & PC_SYM_CONTENTS) if (opt & PC_SYM_CONTENTS)
{ {
strcpy (path, sym.contents); strcpy (path, sym.contents);

View File

@ -162,7 +162,7 @@ class path_conv
} }
void set_binary () {path_flags |= PATH_BINARY;} void set_binary () {path_flags |= PATH_BINARY;}
void set_symlink () {path_flags |= PATH_SYMLINK;} void set_symlink (DWORD n) {path_flags |= PATH_SYMLINK; symlink_length = n;}
void set_has_symlinks () {path_flags |= PATH_HAS_SYMLINKS;} void set_has_symlinks () {path_flags |= PATH_HAS_SYMLINKS;}
void set_isdisk () {path_flags |= PATH_ISDISK; dev.devn = FH_FS;} void set_isdisk () {path_flags |= PATH_ISDISK; dev.devn = FH_FS;}
void set_exec (int x = 1) {path_flags |= x ? PATH_EXEC : PATH_NOTEXEC;} void set_exec (int x = 1) {path_flags |= x ? PATH_EXEC : PATH_NOTEXEC;}
@ -215,7 +215,9 @@ class path_conv
char *normalized_path; char *normalized_path;
size_t normalized_path_size; size_t normalized_path_size;
void set_normalized_path (const char *) __attribute__ ((regparm (2))); void set_normalized_path (const char *) __attribute__ ((regparm (2)));
DWORD get_symlink_length () { return symlink_length; };
private: private:
DWORD symlink_length;
char path[CYG_MAX_PATH]; char path[CYG_MAX_PATH];
}; };