diff options
author | Volker Lendecke <vl@samba.org> | 2012-05-11 13:31:36 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2012-05-14 13:16:32 +0200 |
commit | 87542e1310cfa90e5af0b00d77def969c7b38aef (patch) | |
tree | 5fa705c682f09582ffa25765893b0c7ddfb3fad4 /source3/smbd | |
parent | e945511aae52c0bc50007ffc703241c7da1db372 (diff) | |
download | samba-87542e1310cfa90e5af0b00d77def969c7b38aef.tar.gz samba-87542e1310cfa90e5af0b00d77def969c7b38aef.tar.bz2 samba-87542e1310cfa90e5af0b00d77def969c7b38aef.zip |
s3: Make SMB_QUERY_FILE_UNIX_BASIC's devno work for files
According to susv3, st_rdev is valid exactly for char and block devices. Normal
files have st_dev set.
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/trans2.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 5cfbc3128b..590ee5bf7c 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3959,6 +3959,7 @@ static char *store_file_unix_basic(connection_struct *conn, const SMB_STRUCT_STAT *psbuf) { uint64_t file_index = get_FileIndex(conn, psbuf); + dev_t devno; DEBUG(10,("store_file_unix_basic: SMB_QUERY_FILE_UNIX_BASIC\n")); DEBUG(4,("store_file_unix_basic: st_mode=%o\n",(int)psbuf->st_ex_mode)); @@ -3985,11 +3986,17 @@ static char *store_file_unix_basic(connection_struct *conn, SIVAL(pdata,0,unix_filetype(psbuf->st_ex_mode)); pdata += 4; - SIVAL(pdata,0,unix_dev_major(psbuf->st_ex_rdev)); /* Major device number if type is device */ + if (S_ISBLK(psbuf->st_ex_mode) || S_ISCHR(psbuf->st_ex_mode)) { + devno = psbuf->st_ex_rdev; + } else { + devno = psbuf->st_ex_dev; + } + + SIVAL(pdata,0,unix_dev_major(devno)); /* Major device number if type is device */ SIVAL(pdata,4,0); pdata += 8; - SIVAL(pdata,0,unix_dev_minor(psbuf->st_ex_rdev)); /* Minor device number if type is device */ + SIVAL(pdata,0,unix_dev_minor(devno)); /* Minor device number if type is device */ SIVAL(pdata,4,0); pdata += 8; |