summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-02-03 19:48:56 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-02-03 19:48:56 +0000
commitf24c04fc77370aae1bddb18955fab3b0e8161ad7 (patch)
treeb0057430d3c94e66b871f6d706532ffa5e749565
parentab1b1855bdfe44c07ab32b469d97dd4c5f872315 (diff)
downloadsamba-f24c04fc77370aae1bddb18955fab3b0e8161ad7.tar.gz
samba-f24c04fc77370aae1bddb18955fab3b0e8161ad7.tar.bz2
samba-f24c04fc77370aae1bddb18955fab3b0e8161ad7.zip
Fixed up problems with CDROM filesystems (return EROFS) and
also compile issue with USE_MMAP code. jra@cygnus.com (This used to be commit 8e9fe58991c32817142aa2a6caec1df0c4fa4b08)
-rw-r--r--source3/smbd/server.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 6ab6c76c4a..0146776bbc 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1049,7 +1049,15 @@ void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct stat *s
/* Set the flags as needed without the read/write modes. */
open_flags = flags & ~(O_RDWR|O_WRONLY|O_RDONLY);
fd_ptr->fd = fd_attempt_open(fname, open_flags|O_RDWR, mode);
+ /*
+ * On some systems opening a file for R/W access on a read only
+ * filesystems sets errno to EROFS.
+ */
+#ifdef EROFS
+ if((fd_ptr->fd == -1) && ((errno == EACCES) || (errno == EROFS))) {
+#else /* No EROFS */
if((fd_ptr->fd == -1) && (errno == EACCES)) {
+#endif /* EROFS */
if(flags & O_WRONLY) {
fd_ptr->fd = fd_attempt_open(fname, open_flags|O_WRONLY, mode);
fd_ptr->real_open_flags = O_WRONLY;
@@ -1155,7 +1163,7 @@ void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct stat *s
{
Files[fnum].mmap_size = file_size(fname);
Files[fnum].mmap_ptr = (char *)mmap(NULL,Files[fnum].mmap_size,
- PROT_READ,MAP_SHARED,Files[fnum].fd,0);
+ PROT_READ,MAP_SHARED,Files[fnum]->fd_ptr.fd,0);
if (Files[fnum].mmap_ptr == (char *)-1 || !Files[fnum].mmap_ptr)
{