mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3: printing: Rename printing_read_data() -> printing_pread_data() and add an offset parameter.
Currently pass -1 as the offset, so it's not used. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
e943c5db1f
commit
b927b53ad2
@ -316,8 +316,9 @@ const char *get_short_archi(const char *long_archi)
|
||||
(note: EINTR re-read differs from vfs_write_data)
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t printing_read_data(files_struct *fsp,
|
||||
static ssize_t printing_pread_data(files_struct *fsp,
|
||||
char *buf,
|
||||
off_t *poff_unused,
|
||||
size_t byte_count)
|
||||
{
|
||||
size_t total=0;
|
||||
@ -365,6 +366,7 @@ static int handle_pe_file(files_struct *fsp,
|
||||
ssize_t byte_count;
|
||||
off_t oret;
|
||||
off_t pos;
|
||||
off_t in_pos = -1;
|
||||
int ret = -1;
|
||||
|
||||
/* Just skip over optional header to get to section table */
|
||||
@ -397,7 +399,7 @@ static int handle_pe_file(files_struct *fsp,
|
||||
goto out;
|
||||
}
|
||||
|
||||
byte_count = printing_read_data(fsp, buf, section_table_bytes);
|
||||
byte_count = printing_pread_data(fsp, buf, &in_pos, section_table_bytes);
|
||||
if (byte_count < section_table_bytes) {
|
||||
DBG_NOTICE("PE file [%s] Section header too short, "
|
||||
"bytes read = %lu\n",
|
||||
@ -451,8 +453,9 @@ static int handle_pe_file(files_struct *fsp,
|
||||
goto out;
|
||||
}
|
||||
|
||||
byte_count = printing_read_data(fsp,
|
||||
byte_count = printing_pread_data(fsp,
|
||||
buf,
|
||||
&in_pos,
|
||||
section_bytes);
|
||||
if (byte_count < section_bytes) {
|
||||
DBG_NOTICE("PE file "
|
||||
@ -545,6 +548,7 @@ static int handle_ne_file(files_struct *fsp,
|
||||
unsigned int i;
|
||||
ssize_t byte_count;
|
||||
int ret = -1;
|
||||
off_t in_pos = -1;
|
||||
|
||||
if (CVAL(buf,NE_HEADER_TARGET_OS_OFFSET) != NE_HEADER_TARGOS_WIN ) {
|
||||
DBG_NOTICE("NE file [%s] wrong target OS = 0x%x\n",
|
||||
@ -574,7 +578,7 @@ static int handle_ne_file(files_struct *fsp,
|
||||
* please have at it, but this works. 'NE' files will
|
||||
* eventually fade away. JRR
|
||||
*/
|
||||
byte_count = printing_read_data(fsp, buf, VS_NE_BUF_SIZE);
|
||||
byte_count = printing_pread_data(fsp, buf, &in_pos, VS_NE_BUF_SIZE);
|
||||
while (byte_count > 0) {
|
||||
/*
|
||||
* Cover case that should not occur in a well
|
||||
@ -590,8 +594,9 @@ static int handle_ne_file(files_struct *fsp,
|
||||
* possibly match
|
||||
*/
|
||||
if (buf[i] != 'V') {
|
||||
byte_count = printing_read_data(fsp,
|
||||
byte_count = printing_pread_data(fsp,
|
||||
buf,
|
||||
&in_pos,
|
||||
VS_NE_BUF_SIZE);
|
||||
continue;
|
||||
}
|
||||
@ -606,8 +611,9 @@ static int handle_ne_file(files_struct *fsp,
|
||||
ssize_t amount_unused = byte_count-i;
|
||||
|
||||
memmove(buf, &buf[i], amount_unused);
|
||||
amount_read = printing_read_data(fsp,
|
||||
amount_read = printing_pread_data(fsp,
|
||||
&buf[amount_unused],
|
||||
&in_pos,
|
||||
VS_NE_BUF_SIZE- amount_unused);
|
||||
if (amount_read < 0) {
|
||||
DBG_ERR("NE file [%s] Read "
|
||||
@ -654,8 +660,9 @@ static int handle_ne_file(files_struct *fsp,
|
||||
if (IVAL(buf,
|
||||
i+sizeof(VS_SIGNATURE)+skip)
|
||||
!= 0xfeef04bd) {
|
||||
byte_count = printing_read_data(fsp,
|
||||
byte_count = printing_pread_data(fsp,
|
||||
buf,
|
||||
&in_pos,
|
||||
VS_NE_BUF_SIZE);
|
||||
continue;
|
||||
}
|
||||
@ -708,6 +715,7 @@ static int get_file_version(files_struct *fsp,
|
||||
ssize_t byte_count;
|
||||
off_t pos;
|
||||
off_t oret;
|
||||
off_t in_pos = -1;
|
||||
|
||||
buf=(char *)SMB_MALLOC(DOS_HEADER_SIZE);
|
||||
if (buf == NULL) {
|
||||
@ -717,7 +725,7 @@ static int get_file_version(files_struct *fsp,
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
byte_count = printing_read_data(fsp, buf, DOS_HEADER_SIZE);
|
||||
byte_count = printing_pread_data(fsp, buf, &in_pos, DOS_HEADER_SIZE);
|
||||
if (byte_count < DOS_HEADER_SIZE) {
|
||||
DBG_NOTICE("File [%s] DOS header too short, bytes read = %lu\n",
|
||||
fname,
|
||||
@ -752,7 +760,7 @@ static int get_file_version(files_struct *fsp,
|
||||
pos = oret; /* Update new position. */
|
||||
|
||||
/* Note: DOS_HEADER_SIZE and NE_HEADER_SIZE are incidentally same */
|
||||
byte_count = printing_read_data(fsp, buf, NE_HEADER_SIZE);
|
||||
byte_count = printing_pread_data(fsp, buf, &in_pos, NE_HEADER_SIZE);
|
||||
if (byte_count < NE_HEADER_SIZE) {
|
||||
DBG_NOTICE("File [%s] Windows header too short, "
|
||||
"bytes read = %lu\n",
|
||||
|
Loading…
Reference in New Issue
Block a user