char *smbw_getshared(const char *name);
void smbw_setshared(const char *name, const char *val);
int smbw_setenv(const char *name, const char *value);
+int smbw_shared_fd(int fd);
/*The following definitions come from smbwrapper/smbw.c */
void smbw_init(void);
int smbw_fd(int fd);
+int smbw_local_fd(int fd);
ino_t smbw_inode(const char *name);
void clean_fname(char *name);
char *smbw_parse_path(const char *fname, char *server, char *share, char *path);
return ret;
}
+/*****************************************************************
+return true if the passed fd is the SMBW_HANDLE
+*****************************************************************/
+int smbw_shared_fd(int fd)
+{
+ return (shared_fd && shared_fd == fd);
+}
return smbw_file_bmap && bitmap_query(smbw_file_bmap, fd);
}
+/*****************************************************
+determine if a file descriptor is an internal smbw fd
+*******************************************************/
+int smbw_local_fd(int fd)
+{
+ struct smbw_server *srv;
+
+ smbw_init();
+
+ if (smbw_busy) return 0;
+ if (smbw_shared_fd(fd)) return 1;
+
+ for (srv=smbw_srvs;srv;srv=srv->next) {
+ if (srv->cli.fd == fd) return 1;
+ }
+
+ return 0;
+}
+
/*****************************************************
a crude inode number generator
*******************************************************/
file = smbw_file(fd);
if (!file) {
- DEBUG(3,("bad fd in read\n"));
errno = EBADF;
smbw_busy--;
return -1;
file = smbw_file(fd);
if (!file) {
- DEBUG(3,("bad fd in read\n"));
errno = EBADF;
smbw_busy--;
return -1;