From 4750ce1760a39100f71e74ce8b88a925fef4c42f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 8 Oct 1998 02:28:21 +0000 Subject: use 1 second resolution calls if possible (This used to be commit 349469221a84658048790d7567b4fcea43c0b759) --- source3/include/proto.h | 4 ++-- source3/libsmb/clientgen.c | 7 +++++-- source3/smbwrapper/smbw.h | 1 + source3/smbwrapper/smbw_stat.c | 8 ++++---- source3/utils/torture.c | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index 07392239fab..062fe352648 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -400,9 +400,9 @@ BOOL cli_setatr(struct cli_state *cli, char *fname, int attr, time_t t); BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, time_t *c_time, time_t *a_time, time_t *m_time, size_t *size, uint32 *mode); -BOOL cli_qpathinfo2(struct cli_state *cli, char *fname, +BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, time_t *c_time, time_t *a_time, time_t *m_time, - time_t *w_time, uint32 *size); + time_t *w_time, size_t *size, uint32 *mode); BOOL cli_qfileinfo(struct cli_state *cli, int fnum, uint32 *mode, size_t *size, time_t *c_time, time_t *a_time, time_t *m_time); diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 38b4b5ffeb2..657523b3beb 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -1557,9 +1557,9 @@ BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, /**************************************************************************** send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level ****************************************************************************/ -BOOL cli_qpathinfo2(struct cli_state *cli, char *fname, +BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, time_t *c_time, time_t *a_time, time_t *m_time, - time_t *w_time, uint32 *size) + time_t *w_time, size_t *size, uint32 *mode) { int data_len = 0; int param_len = 0; @@ -1608,6 +1608,9 @@ BOOL cli_qpathinfo2(struct cli_state *cli, char *fname, if (size) { *size = IVAL(rdata, 40); } + if (mode) { + *mode = IVAL(rdata, 32); + } if (rdata) free(rdata); if (rparam) free(rparam); diff --git a/source3/smbwrapper/smbw.h b/source3/smbwrapper/smbw.h index 43fb14bce07..b0cf2dc2e13 100644 --- a/source3/smbwrapper/smbw.h +++ b/source3/smbwrapper/smbw.h @@ -37,6 +37,7 @@ struct smbw_server { char *server_name; char *share_name; dev_t dev; + BOOL no_pathinfo2; }; struct smbw_filedes { diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c index ec920eb1768..d9e2aa250c7 100644 --- a/source3/smbwrapper/smbw_stat.c +++ b/source3/smbwrapper/smbw_stat.c @@ -65,16 +65,16 @@ BOOL smbw_getatr(struct smbw_server *srv, char *path, { DEBUG(5,("sending qpathinfo\n")); - if (cli_qpathinfo(&srv->cli, path, c_time, a_time, m_time, - size, mode)) return True; - - DEBUG(5,("qpathinfo OK\n")); + if (!srv->no_pathinfo2 && + cli_qpathinfo2(&srv->cli, path, c_time, a_time, m_time, NULL, + size, mode)) return True; /* if this is NT then don't bother with the getatr */ if (srv->cli.capabilities & CAP_NT_SMBS) return False; if (cli_getatr(&srv->cli, path, mode, size, m_time)) { a_time = c_time = m_time; + srv->no_pathinfo2 = True; return True; } return False; diff --git a/source3/utils/torture.c b/source3/utils/torture.c index e7bd347993a..b49ad612637 100644 --- a/source3/utils/torture.c +++ b/source3/utils/torture.c @@ -809,7 +809,7 @@ static void run_trans2test(void) O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); cli_close(&cli, fnum); if (!cli_qpathinfo2(&cli, fname, &c_time, &a_time, &m_time, - &w_time, &size, NULL)) { + &w_time, &size, NULL, NULL)) { printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli)); } else { if (w_time < 60*60*24*2) { @@ -828,7 +828,7 @@ static void run_trans2test(void) } sleep(3); if (!cli_qpathinfo2(&cli, "\\trans2\\", &c_time, &a_time, &m_time, - &w_time, &size, NULL)) { + &w_time, &size, NULL, NULL)) { printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli)); } @@ -837,7 +837,7 @@ static void run_trans2test(void) cli_write(&cli, fnum, (char *)&fnum, 0, sizeof(fnum)); cli_close(&cli, fnum); if (!cli_qpathinfo2(&cli, "\\trans2\\", &c_time, &a_time, &m_time2, - &w_time, &size, NULL)) { + &w_time, &size, NULL, NULL)) { printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli)); } else { if (m_time2 == m_time) -- cgit