svn commit: samba r3131 - in branches/SAMBA_4_0/source: libcli/util
ntvfs/simple
tridge at samba.org
tridge at samba.org
Fri Oct 22 06:49:40 GMT 2004
Author: tridge
Date: 2004-10-22 06:49:27 +0000 (Fri, 22 Oct 2004)
New Revision: 3131
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=3131&nolog=1
Log:
- make map_nt_error_from_unix() return NT_STATUS_UNSUCCESSFUL if errno is 0
- more consistent checking for system call return values in simple backend
Modified:
branches/SAMBA_4_0/source/libcli/util/errormap.c
branches/SAMBA_4_0/source/ntvfs/simple/vfs_simple.c
Changeset:
Modified: branches/SAMBA_4_0/source/libcli/util/errormap.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/util/errormap.c 2004-10-22 06:46:04 UTC (rev 3130)
+++ branches/SAMBA_4_0/source/libcli/util/errormap.c 2004-10-22 06:49:27 UTC (rev 3131)
@@ -1534,13 +1534,13 @@
/*********************************************************************
Map an NT error code from a Unix error code.
*********************************************************************/
-
NTSTATUS map_nt_error_from_unix(int unix_error)
{
int i = 0;
- if (unix_error == 0)
- return NT_STATUS_OK;
+ if (unix_error == 0) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
/* Look through list */
while(unix_dos_nt_errmap[i].unix_error != 0) {
Modified: branches/SAMBA_4_0/source/ntvfs/simple/vfs_simple.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/simple/vfs_simple.c 2004-10-22 06:46:04 UTC (rev 3130)
+++ branches/SAMBA_4_0/source/ntvfs/simple/vfs_simple.c 2004-10-22 06:49:27 UTC (rev 3131)
@@ -262,8 +262,6 @@
DEBUG(19,("svfs_qpathinfo: file %s\n", unix_path));
if (stat(unix_path, &st) == -1) {
DEBUG(19,("svfs_qpathinfo: file %s errno=%d\n", unix_path, errno));
- if (errno == 0)
- errno = ENOENT;
return map_nt_error_from_unix(errno);
}
DEBUG(19,("svfs_qpathinfo: file %s, stat done\n", unix_path));
@@ -290,8 +288,6 @@
}
if (fstat(info->generic.in.fnum, &st) == -1) {
- if (errno == 0)
- errno = ENOENT;
return map_nt_error_from_unix(errno);
}
@@ -372,15 +368,11 @@
do_open:
fd = open(unix_path, flags, 0644);
if (fd == -1) {
- if (errno == 0)
- errno = ENOENT;
return map_nt_error_from_unix(errno);
}
if (fstat(fd, &st) == -1) {
DEBUG(9,("svfs_open: fstat errno=%d\n", errno));
- if (errno == 0)
- errno = ENOENT;
close(fd);
return map_nt_error_from_unix(errno);
}
@@ -465,7 +457,7 @@
unix_path1 = svfs_unix_path(ntvfs, req, ren->rename.in.pattern1);
unix_path2 = svfs_unix_path(ntvfs, req, ren->rename.in.pattern2);
- if (rename(unix_path1, unix_path2) != 0) {
+ if (rename(unix_path1, unix_path2) == -1) {
return map_nt_error_from_unix(errno);
}
@@ -593,7 +585,7 @@
return NT_STATUS_INVALID_HANDLE;
}
- if (close(io->close.in.fnum) != 0) {
+ if (close(io->close.in.fnum) == -1) {
return map_nt_error_from_unix(errno);
}
@@ -669,7 +661,7 @@
case RAW_SFILEINFO_END_OF_FILE_INFO:
case RAW_SFILEINFO_END_OF_FILE_INFORMATION:
if (ftruncate(info->end_of_file_info.file.fnum,
- info->end_of_file_info.in.size) != 0) {
+ info->end_of_file_info.in.size) == -1) {
return map_nt_error_from_unix(errno);
}
break;
@@ -752,7 +744,7 @@
return ntvfs_map_fsattr(req, fs, ntvfs);
}
- if (stat(private->connectpath, &st) != 0) {
+ if (stat(private->connectpath, &st) == -1) {
return map_nt_error_from_unix(errno);
}
More information about the samba-cvs
mailing list