[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
smbfs smbnetfs.c
From: |
Ludovic Courtès |
Subject: |
smbfs smbnetfs.c |
Date: |
Sun, 04 Mar 2012 21:24:09 +0000 |
CVSROOT: /sources/hurdextras
Module name: smbfs
Changes by: Ludovic Courtès <civodul> 12/03/04 21:24:09
Modified files:
. : smbnetfs.c
Log message:
Fix `mode' argument to `smbc_open'; fix `netfs_attempt_set_size'.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/smbfs/smbnetfs.c?cvsroot=hurdextras&r1=1.10&r2=1.11
Patches:
Index: smbnetfs.c
===================================================================
RCS file: /sources/hurdextras/smbfs/smbnetfs.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- smbnetfs.c 4 Mar 2012 17:22:41 -0000 1.10
+++ smbnetfs.c 4 Mar 2012 21:24:09 -0000 1.11
@@ -333,59 +333,24 @@
}
error_t
-netfs_attempt_set_size (struct iouser * cred, struct node * np, loff_t size)
+netfs_attempt_set_size (struct iouser *cred, struct node *np, loff_t size)
{
- int ret = 0;
- int fd;
- int current_filesize;
+ int fd, ret, saved_errno;
mutex_lock (&smb_mutex);
- fd = smbc_open (np->nn->filename, O_WRONLY | O_CREAT, O_RDWR);
+ fd = smbc_open (np->nn->filename, O_WRONLY, 0);
mutex_unlock (&smb_mutex);
if (fd < 0)
return errno;
mutex_lock (&smb_mutex);
-
- current_filesize = smbc_lseek (fd, 0, SEEK_END);
-
- mutex_unlock (&smb_mutex);
-
- if (current_filesize < 0)
- {
- mutex_lock (&smb_mutex);
- smbc_close (fd);
- mutex_unlock (&smb_mutex);
- return errno;
- }
-
- if (current_filesize < size)
- {
- /* FIXME. trunc here. */
- mutex_lock (&smb_mutex);
+ ret = smbc_ftruncate (fd, size);
+ saved_errno = ret != 0 ? errno : 0;
smbc_close (fd);
- fd = smbc_open (np->nn->filename, O_WRONLY | O_TRUNC, O_RDWR);
mutex_unlock (&smb_mutex);
- current_filesize = 0;
- }
- mutex_lock (&smb_mutex);
- ret=smbc_lseek (fd, size, SEEK_SET);
- mutex_unlock (&smb_mutex);
-
- if (ret < 0)
- {
- mutex_lock (&smb_mutex);
- smbc_close (fd);
- mutex_unlock (&smb_mutex);
- return errno;
- }
-
- mutex_lock (&smb_mutex);
- smbc_close (fd);
- mutex_unlock (&smb_mutex);
- return 0;
+ return saved_errno;
}
error_t
@@ -600,7 +565,7 @@
return ENOMEM;
mutex_lock (&smb_mutex);
- fd = smbc_open (filename, O_WRONLY | O_CREAT , O_RDWR);
+ fd = smbc_open (filename, O_WRONLY | O_CREAT, mode);
if (fd < 0)
{
mutex_unlock (&smb_mutex);
@@ -662,7 +627,7 @@
int ret = 0;
mutex_lock (&smb_mutex);
- fd = smbc_open (np->nn->filename, O_RDONLY, O_RDWR);
+ fd = smbc_open (np->nn->filename, O_RDONLY, 0);
mutex_unlock (&smb_mutex);
if (fd < 0)
@@ -712,7 +677,7 @@
int fd;
mutex_lock (&smb_mutex);
- fd = smbc_open (np->nn->filename, O_WRONLY, O_RDWR);
+ fd = smbc_open (np->nn->filename, O_WRONLY, 0);
mutex_unlock (&smb_mutex);
if (fd < 0)
- smbfs smbnetfs.c, Ludovic Courtès, 2012/03/04
- smbfs smbnetfs.c, Ludovic Courtès, 2012/03/04
- smbfs smbnetfs.c, Ludovic Courtès, 2012/03/04
- smbfs smbnetfs.c, Ludovic Courtès, 2012/03/04
- smbfs smbnetfs.c,
Ludovic Courtès <=
- smbfs smbnetfs.c, Ludovic Courtès, 2012/03/05
- smbfs smbnetfs.c, Ludovic Courtès, 2012/03/05
- smbfs smbnetfs.c, Ludovic Courtès, 2012/03/14