Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Branch b1_4
[fs/lustre-release.git]
/
libsysio
/
src
/
truncate.c
diff --git
a/libsysio/src/truncate.c
b/libsysio/src/truncate.c
index
abecb42
..
5846ad3
100644
(file)
--- a/
libsysio/src/truncate.c
+++ b/
libsysio/src/truncate.c
@@
-43,6
+43,7
@@
#include <unistd.h>
#include <string.h>
#include <unistd.h>
#include <string.h>
+#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include <sys/types.h>
#include <errno.h>
#include <assert.h>
#include <sys/types.h>
@@
-52,6
+53,8
@@
#include "sysio.h"
#include "inode.h"
#include "file.h"
#include "sysio.h"
#include "inode.h"
#include "file.h"
+#include "fs.h"
+#include "mount.h"
#include "sysio-symbols.h"
#include "sysio-symbols.h"
@@
-133,6
+136,10
@@
PREPEND(_, SYSIO_INTERFACE_NAME(ftruncate))(int fd, _SYSIO_OFF_T length)
err = -EBADF;
goto out;
}
err = -EBADF;
goto out;
}
+ if (!F_CHKRW(fil, 'w')) {
+ err = -EBADF;
+ goto out;
+ }
err = do_truncate(NULL, fil->f_ino, length);
out:
SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
err = do_truncate(NULL, fil->f_ino, length);
out:
SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);