* 1.3.5: write(2) system call fails with 0 length
@ 2001-11-02 11:28 Randy Reitz
2001-11-02 11:44 ` Shun-ichi GOTO
2001-11-11 8:26 ` Randy Reitz
0 siblings, 2 replies; 8+ messages in thread
From: Randy Reitz @ 2001-11-02 11:28 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 863 bytes --]
Folks,
I upgraded 1.3.3 to 1.3.5 over the weekend. Yesterday (Monday, 11/12) I
could no longer get a kerberos ticket using the MIT kinit. Kinit returned
an "internal error". After some investigation, I find that the problem is
with the write(2) system call when the length of the write is 0. Here is a
test program....
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
main()
{
int fd, ret;
char * buf[4];
buf[0] = buf[1] = buf[2] = buf[3] = '0';
fd = open( "foo", O_RDWR );
ret = write( fd, (char *) buf, 4);
ret = write( fd, (char *)0, 0);
printf("ret=%d, errno=%d\n", ret, errno);
close( fd );
}
Under 1.3.5, this program yields
$ a.exe
ret=-1, errno=14
Under 1.3.3, this program works (ret=0, errno=0).
Thanks
Randy Reitz
[-- Attachment #2: Type: text/plain, Size: 16134 bytes --]
Cygnus Win95/NT Configuration Diagnostics
Current System Time: Tue Nov 13 21:49:55 2001
Win2000 Ver 5.0 build 2195 Service Pack 2
Path: c:\mysql\bin
C:\cygwin\usr\local\bin
C:\cygwin\bin
C:\cygwin\bin
g:\oracle\ora81\bin
c:\Program Files\Oracle\jre\1.1.7\bin
C:\cygwin\bin
c:\WINNT\system32
c:\WINNT
c:\WINNT\System32\Wbem
c:\Program Files\Resource Pro Kit\
.
SysDir: C:\WINNT\System32
WinDir: C:\WINNT
HOME = `C:\cygwin\home\rreitz'
MAKE_MODE = `unix'
PWD = `/home/rreitz'
USER = `rreitz'
ALLUSERSPROFILE = `C:\Documents and Settings\All Users'
APPDATA = `C:\Documents and Settings\rreitz\Application Data'
CLASSPATH = `C:\Program Files\PhotoDeluxe BE 1.1\AdobeConnectables;'
COMMONPROGRAMFILES = `C:\Program Files\Common Files'
COMPUTERNAME = `DIRT'
COMSPEC = `C:\WINNT\system32\cmd.exe'
CORPATH = `C:\WINNT\Microsoft.NET\Framework\v1.0.2204\'
DISKEEPERICON = `C:\Program Files\Executive Software\DiskeeperWorkstation\'
HOMEDRIVE = `C:'
HOMEPATH = `\'
HOSTNAME = `DIRT'
HOSTTYPE = `i686'
LIB = `C:\Program Files\Microsoft.Net\FrameworkSDK\Lib'
LOGONSERVER = `\\DIRT'
MACHTYPE = `i686-pc-cygwin'
NUMBER_OF_PROCESSORS = `1'
OLDPWD = `/usr/bin'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
OSTYPE = `cygwin'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 4 Stepping 2, AuthenticAMD'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0402'
PROGRAMFILES = `C:\Program Files'
PROMPT = `$P$G'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
ROOTDIR = `c:'
SHELL = `c:/mksnt/sh.exe'
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `c:\DOCUME~1\rreitz\LOCALS~1\Temp'
TERM = `cygwin'
USERDOMAIN = `DIRT'
USERNAME = `rreitz'
USERPROFILE = `C:\Documents and Settings\rreitz'
WINDIR = `C:\WINNT'
_ = `/usr/bin/cygcheck'
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
(default) = `/cygdrive'
cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/c
(default) = `c:'
flags = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/k
(default) = `k:'
flags = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
(default) = `\\.\tape1:'
unix = `/dev/st1'
fbinary = 0x00000000
fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
(default) = `\\.\tape0:'
unix = `/dev/st0'
fbinary = 0x00000000
fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
(default) = `\\.\b:'
unix = `/dev/fd1'
fbinary = 0x00000000
fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
(default) = `\\.\a:'
unix = `/dev/fd0'
fbinary = 0x00000000
fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
(default) = `C:'
unix = `/'
fbinary = 0x00000000
fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\Cygnus Solutions
(default) = (unsupported type)
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
(default) = `C:/cygwin'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
(default) = `C:/cygwin/bin'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
(default) = `C:/cygwin/lib'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\05
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\06
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\07
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\08
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\09
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0E
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0F
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\10
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\11
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\12
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\13
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\14
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\15
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\16
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\17
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\18
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\19
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1D
a: fd N/A N/A
c: hd NTFS 9538Mb 55% CP CS UN PA FC Win2K
d: cd N/A N/A
e: cd CDFS 643Mb 100% CS TN0106
f: hd FAT32 1029Mb 17% CP UN
g: hd NTFS 9993Mb 18% CP CS UN PA FC Data Volume
h: net NTFS 18648Mb 50% CP CS PA .
k: net NTFS 29329Mb 59% CP CS UN PA FC your_way
c: /c user textmode
k: /k user textmode
. /cygdrive user binmode,noumount
C:/cygwin / system binmode
C:/cygwin/bin /usr/bin system binmode
C:/cygwin/lib /usr/lib system binmode
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\sh.exe
56k 2000/12/03 C:\cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
"cygbz21.0.dll" v0.0 ts=2000/11/20 17:53
45k 2001/04/25 C:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
"cygform5.dll" v0.0 ts=2001/4/25 0:28
34k 2001/09/30 C:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
"cygform6.dll" v0.0 ts=2001/9/29 21:43
18k 2000/10/23 C:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
"cyggdbm.dll" v0.0 ts=2000/10/22 21:26
17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
"cyghistory4.dll" v0.0 ts=2001/1/6 22:34
21k 2001/06/28 C:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
"cyghistory5.dll" v0.0 ts=2001/6/27 21:27
21k 2001/06/20 C:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
"cygintl.dll" v0.0 ts=2001/6/20 12:09
81k 2001/10/20 C:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
"cygitcl30.dll" v0.0 ts=2001/10/19 19:25
35k 2001/10/20 C:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
"cygitk30.dll" v0.0 ts=2001/10/19 19:25
45k 2001/07/04 C:\cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
"cygjbig1.dll" v0.0 ts=2001/7/3 22:25
119k 2001/06/06 C:\cygwin\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0
"cygjpeg6b.dll" v0.0 ts=2001/6/5 23:27
26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
"cygmenu5.dll" v0.0 ts=2001/4/25 0:27
19k 2001/09/30 C:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
"cygmenu6.dll" v0.0 ts=2001/9/29 21:43
156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
"cygncurses++5.dll" v0.0 ts=2001/4/25 0:29
175k 2001/09/30 C:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
"cygncurses++6.dll" v0.0 ts=2001/9/29 21:45
226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
"cygncurses5.dll" v0.0 ts=2001/4/25 0:17
201k 2001/09/30 C:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
"cygncurses6.dll" v0.0 ts=2001/9/29 21:42
15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
"cygpanel5.dll" v0.0 ts=2001/4/25 0:27
12k 2001/09/30 C:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
"cygpanel6.dll" v0.0 ts=2001/9/29 21:43
163k 2001/05/06 C:\cygwin\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0
"cygpng2.dll" v0.0 ts=2001/5/5 23:05
108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
"cygreadline4.dll" v0.0 ts=2001/1/6 22:34
135k 2001/06/28 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
"cygreadline5.dll" v0.0 ts=2001/6/27 21:27
390k 2001/10/20 C:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
"cygtcl80.dll" v0.0 ts=2001/10/19 19:24
5k 2001/10/20 C:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
10k 2001/10/20 C:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
"cygtclreg80.dll" v0.0 ts=2001/10/19 19:24
245k 2001/06/12 C:\cygwin\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0
"cygtiff3.dll" v0.0 ts=2001/6/12 12:25
623k 2001/10/20 C:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
"cygtk80.dll" v0.0 ts=2001/10/19 19:25
41k 2001/07/04 C:\cygwin\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0
"cygXpm-noX4.dll" v0.0 ts=2001/7/3 20:21
45k 2001/07/04 C:\cygwin\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0
"cygXpm-X4.dll" v0.0 ts=2000/11/19 20:45
49k 2001/02/03 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
"cygz.dll" v0.0 ts=2001/2/3 14:35
714k 2001/11/12 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
"cygwin1.dll" v0.0 ts=2001/11/11 18:01
Cygwin DLL version info:
DLL version: 1.3.5
DLL epoch: 19
DLL bad signal mask: 19005
DLL old termios: 5
DLL malloc env: 28
API major: 0
API minor: 47
Shared data: 3
DLL identifier: cygwin1
Mount registry: 2
Cygnus registry name: Cygnus Solutions
Cygwin registry name: Cygwin
Program options name: Program Options
Cygwin mount registry name: mounts v2
Cygdrive flags: cygdrive flags
Cygdrive prefix: cygdrive prefix
Cygdrive default prefix:
Build date: Sun Nov 11 19:01:54 EST 2001
Shared id: cygwin1S3
Cygwin Package Information
Last downloaded files to:
Last downloaded files from: ftp://mirrors.rcn.net/mirrors/sources.redhat.com/cygwin
Package Version
ash 20011018-1
autoconf 2.52-1
automake 1.5-1
bash 2.05-8
binutils 20011002-1
bison 1.28-1
byacc 0.0
bzip2 1.0.1-6
clear 1.0
cpio 2.4.2
cron 3.0.1-5
crypt 1.0-1
ctags 5.0.1-1
cvs 1.11.0-1
cygrunsrv 0.94-2
cygwin 1.3.5-1
cygwin-src 1.3.5-1
dejagnu 20010117-1
diff 0.0
expect 20010117-1
file 3.33-1
fileutils 4.1-1
findutils 0.0
flex 2.5.4-1
gawk 3.0.4-1
gcc 2.95.3-5
gdb 20010428-3
gdbm 1.8.0-3
gettext 0.10.38-2
ghostscript 6.51-1
gperf 0.0
grep 2.4.2-1
groff 1.16.1-1
gzip 1.3-1
inetutils 1.3.2-15
irc 20010101-1
jbigkit 1.2-4
jpeg 6b-4
less 358-3
libncurses5 5.2-1
libncurses6 5.2-2
libpng 1.0.11-1
login 1.4-2
lynx 2.8.4-1
m4 0.0
make 3.79.1-4
man 1.5g-2
mingw 20010917-1
mingw-runtime 1.1-1
mt 1.9.2-1
mutt 1.2.5i-5
ncftp 3.0.2-2
ncurses 5.2-7
newlib-man 20001118-1
opengl 1.1.0-5
openssh 3.0p1-1
openssl 0.9.6b-1
patch 2.5-2
pcre 3.4-2
perl 5.6.1-1
popt 1.6.1-1
postgresql 7.1.3-1
python 2.1.1-2
readline 4.2-3
regex 4.4
rsync 2.4.6-2
rxvt 2.7.2-6
sed 3.02-1
sh-utils 2.0-2
squid 2.4-STABLE20010508
ssmtp 2.38.7-3
tar 1.13.19-1
tcltk 20001125-1
tcsh 6.10.00-3
termcap 20010825-1
terminfo 5.2-1
tetex-beta 20001218-1
texinfo 4.0-4
textutils 2.0.16-1
tiff 3.5.6beta-2
time 1.7-1
unzip 5.41-1
vim 6.0.93-1
w32api 1.1-1
wget 1.7-1
which 1.4
xpm 4.0.0-2
xpm-nox 4.1.0-1
zip 2.3-1
zlib 1.1.3-6
Use -h to see help about each section
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
[-- Attachment #4: Type: text/plain, Size: 214 bytes --]
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 1.3.5: write(2) system call fails with 0 length
2001-11-02 11:28 1.3.5: write(2) system call fails with 0 length Randy Reitz
@ 2001-11-02 11:44 ` Shun-ichi GOTO
2001-11-11 8:26 ` Pavel Tsekov
2001-11-11 8:26 ` Shun-ichi GOTO
2001-11-11 8:26 ` Randy Reitz
1 sibling, 2 replies; 8+ messages in thread
From: Shun-ichi GOTO @ 2001-11-02 11:44 UTC (permalink / raw)
To: rreitz; +Cc: cygwin
>>>>> at Tue, 13 Nov 2001 21:58:32 -0600
>>>>> Randy Reitz <rreitz@mssinternet.com> said,>
> Here is a test program....
It's strange test.
Do like this, and get result: "2nd write() failed: Bad address".
So you should give valid pointer as 2nd argument of 2nd write() call.
for example, write (fd, buf, 0);
main()
{
int fd, ret;
char * buf[4];
buf[0] = buf[1] = buf[2] = buf[3] = '0';
fd = open( "foo", O_RDWR|O_CREAT ); /* O_CREATE required */
if (fd < 0) {
perror("open() failed");
exit(1);
}
ret = write( fd, (char *) buf, 4);
if (ret < 0) {
perror("1st write() failed");
exit(2);
}
ret = write( fd, (char *)0, 0); /* NULL ptr is not allowed */
if (ret < 0) {
perror("2nd write() failed");
exit(3);
}
printf("ret=%d, errno=%d\n", ret, errno);
close( fd );
}
--- Regards,
Shun-ichi Goto <gotoh@taiyo.co.jp>
R&D Group, TAIYO Corp., Tokyo, JAPAN
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 1.3.5: write(2) system call fails with 0 length
2001-11-02 11:44 ` Shun-ichi GOTO
2001-11-11 8:26 ` Pavel Tsekov
@ 2001-11-11 8:26 ` Shun-ichi GOTO
1 sibling, 0 replies; 8+ messages in thread
From: Shun-ichi GOTO @ 2001-11-11 8:26 UTC (permalink / raw)
To: rreitz; +Cc: cygwin
>>>>> at Tue, 13 Nov 2001 21:58:32 -0600
>>>>> Randy Reitz <rreitz@mssinternet.com> said,>
> Here is a test program....
It's strange test.
Do like this, and get result: "2nd write() failed: Bad address".
So you should give valid pointer as 2nd argument of 2nd write() call.
for example, write (fd, buf, 0);
main()
{
int fd, ret;
char * buf[4];
buf[0] = buf[1] = buf[2] = buf[3] = '0';
fd = open( "foo", O_RDWR|O_CREAT ); /* O_CREATE required */
if (fd < 0) {
perror("open() failed");
exit(1);
}
ret = write( fd, (char *) buf, 4);
if (ret < 0) {
perror("1st write() failed");
exit(2);
}
ret = write( fd, (char *)0, 0); /* NULL ptr is not allowed */
if (ret < 0) {
perror("2nd write() failed");
exit(3);
}
printf("ret=%d, errno=%d\n", ret, errno);
close( fd );
}
--- Regards,
Shun-ichi Goto <gotoh@taiyo.co.jp>
R&D Group, TAIYO Corp., Tokyo, JAPAN
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATHC] Re: 1.3.5: write(2) system call fails with 0 length
2001-11-11 8:26 ` Corinna Vinschen
@ 2001-11-11 8:26 ` Pavel Tsekov
0 siblings, 0 replies; 8+ messages in thread
From: Pavel Tsekov @ 2001-11-11 8:26 UTC (permalink / raw)
To: Corinna Vinschen; +Cc: cygwin-patches
Corinna Vinschen wrote:
>
> On Thu, Nov 15, 2001 at 12:53:42PM +0100, Pavel Tsekov wrote:
> > There was no feedback on this so I post again :) Is this
> > cygwin behaviour the expected behaviour ?
>
> Should be fixed in the developers sources.
Doh - I haven't checked the CVS yet :) Ok, sorry :)
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 1.3.5: write(2) system call fails with 0 length
2001-11-02 11:44 ` Shun-ichi GOTO
@ 2001-11-11 8:26 ` Pavel Tsekov
2001-11-11 8:26 ` [PATHC] " Pavel Tsekov
2001-11-11 8:26 ` Shun-ichi GOTO
1 sibling, 1 reply; 8+ messages in thread
From: Pavel Tsekov @ 2001-11-11 8:26 UTC (permalink / raw)
To: Shun-ichi GOTO; +Cc: rreitz, cygwin
[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]
Shun-ichi GOTO wrote:
>
> >>>>> at Tue, 13 Nov 2001 21:58:32 -0600
> >>>>> Randy Reitz <rreitz@mssinternet.com> said,>
>
> > Here is a test program....
>
> It's strange test.
> Do like this, and get result: "2nd write() failed: Bad address".
> So you should give valid pointer as 2nd argument of 2nd write() call.
> for example, write (fd, buf, 0);
>
It's not so strange if you think about it :) If a length of 0 is given
there is no reason to check the pointer for being valid IMO.
However here is what the linux man page says about write - havent
checked
any other source which may be more confident though:
RETURN VALUE
On success, the number of bytes written are returned (zero
indicates nothing was written).
On error, -1 is returned, and errno is set appropriately. If
count is zero and the file
descriptor refers to a regular file, 0 will be returned without
causing any other effect.
For a special file, the results are not portable.
So at least linux just checks for valid fd when the len is 0.
And the testcase which Randy posted is just fine when run on Linux of
course
if the file exists.
[ptsekov@enigma Src]$ ~/Src/write_test
ret=0, errno=0
If the file does not exists at the time the testcase is run i get:
[ptsekov@enigma Src]$ ~/Src/write_test
ret=-1, errno=9 (Bad file descriptor)
Attached is a simple patch which moves the buffer check after the
check for valid file descriptor and the check for zero len.
2001-11-14 Pavel Tsekov <ptsekov@syntrex.com>
* syscalls.cc (_write): Check if the third argument of _write() is zero.
If the first argument of _write() is a valid file descriptor and the
third
argument is zero - return 0 without doing anything else.
Perform a validation check on the second argument of _write() only if
the
_write() is requested on a valid file descriptor and the length of the
buffer being written is not zero.
[-- Attachment #2: syscalls.cc.diff --]
[-- Type: text/plain, Size: 625 bytes --]
--- syscalls.cc.ORIG Wed Nov 14 10:33:03 2001
+++ syscalls.cc Wed Nov 14 10:36:41 2001
@@ -355,15 +355,21 @@ _read (int fd, void *ptr, size_t len)
extern "C" ssize_t
_write (int fd, const void *ptr, size_t len)
{
- if (__check_invalid_read_ptr_errno (ptr, len))
- return -1;
-
int res = -1;
sigframe thisframe (mainthread);
cygheap_fdget cfd (fd);
if (cfd < 0)
goto done;
+
+ if (len == 0)
+ {
+ res = 0;
+ goto done;
+ }
+
+ if (__check_invalid_read_ptr_errno (ptr, len))
+ return -1;
/* Could block, so let user know we at least got here. */
if (fd == 1 || fd == 2)
[-- Attachment #3: Type: text/plain, Size: 214 bytes --]
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATHC] Re: 1.3.5: write(2) system call fails with 0 length
2001-11-11 8:26 ` [PATHC] " Pavel Tsekov
@ 2001-11-11 8:26 ` Corinna Vinschen
2001-11-11 8:26 ` Pavel Tsekov
0 siblings, 1 reply; 8+ messages in thread
From: Corinna Vinschen @ 2001-11-11 8:26 UTC (permalink / raw)
To: cygwin, cygwin-patches
On Thu, Nov 15, 2001 at 12:53:42PM +0100, Pavel Tsekov wrote:
> There was no feedback on this so I post again :) Is this
> cygwin behaviour the expected behaviour ?
Should be fixed in the developers sources.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
* 1.3.5: write(2) system call fails with 0 length
2001-11-02 11:28 1.3.5: write(2) system call fails with 0 length Randy Reitz
2001-11-02 11:44 ` Shun-ichi GOTO
@ 2001-11-11 8:26 ` Randy Reitz
1 sibling, 0 replies; 8+ messages in thread
From: Randy Reitz @ 2001-11-11 8:26 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 863 bytes --]
Folks,
I upgraded 1.3.3 to 1.3.5 over the weekend. Yesterday (Monday, 11/12) I
could no longer get a kerberos ticket using the MIT kinit. Kinit returned
an "internal error". After some investigation, I find that the problem is
with the write(2) system call when the length of the write is 0. Here is a
test program....
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
main()
{
int fd, ret;
char * buf[4];
buf[0] = buf[1] = buf[2] = buf[3] = '0';
fd = open( "foo", O_RDWR );
ret = write( fd, (char *) buf, 4);
ret = write( fd, (char *)0, 0);
printf("ret=%d, errno=%d\n", ret, errno);
close( fd );
}
Under 1.3.5, this program yields
$ a.exe
ret=-1, errno=14
Under 1.3.3, this program works (ret=0, errno=0).
Thanks
Randy Reitz
[-- Attachment #2: Type: text/plain, Size: 16134 bytes --]
Cygnus Win95/NT Configuration Diagnostics
Current System Time: Tue Nov 13 21:49:55 2001
Win2000 Ver 5.0 build 2195 Service Pack 2
Path: c:\mysql\bin
C:\cygwin\usr\local\bin
C:\cygwin\bin
C:\cygwin\bin
g:\oracle\ora81\bin
c:\Program Files\Oracle\jre\1.1.7\bin
C:\cygwin\bin
c:\WINNT\system32
c:\WINNT
c:\WINNT\System32\Wbem
c:\Program Files\Resource Pro Kit\
.
SysDir: C:\WINNT\System32
WinDir: C:\WINNT
HOME = `C:\cygwin\home\rreitz'
MAKE_MODE = `unix'
PWD = `/home/rreitz'
USER = `rreitz'
ALLUSERSPROFILE = `C:\Documents and Settings\All Users'
APPDATA = `C:\Documents and Settings\rreitz\Application Data'
CLASSPATH = `C:\Program Files\PhotoDeluxe BE 1.1\AdobeConnectables;'
COMMONPROGRAMFILES = `C:\Program Files\Common Files'
COMPUTERNAME = `DIRT'
COMSPEC = `C:\WINNT\system32\cmd.exe'
CORPATH = `C:\WINNT\Microsoft.NET\Framework\v1.0.2204\'
DISKEEPERICON = `C:\Program Files\Executive Software\DiskeeperWorkstation\'
HOMEDRIVE = `C:'
HOMEPATH = `\'
HOSTNAME = `DIRT'
HOSTTYPE = `i686'
LIB = `C:\Program Files\Microsoft.Net\FrameworkSDK\Lib'
LOGONSERVER = `\\DIRT'
MACHTYPE = `i686-pc-cygwin'
NUMBER_OF_PROCESSORS = `1'
OLDPWD = `/usr/bin'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
OSTYPE = `cygwin'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 4 Stepping 2, AuthenticAMD'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0402'
PROGRAMFILES = `C:\Program Files'
PROMPT = `$P$G'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
ROOTDIR = `c:'
SHELL = `c:/mksnt/sh.exe'
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `c:\DOCUME~1\rreitz\LOCALS~1\Temp'
TERM = `cygwin'
USERDOMAIN = `DIRT'
USERNAME = `rreitz'
USERPROFILE = `C:\Documents and Settings\rreitz'
WINDIR = `C:\WINNT'
_ = `/usr/bin/cygcheck'
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
(default) = `/cygdrive'
cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/c
(default) = `c:'
flags = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/k
(default) = `k:'
flags = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
(default) = `\\.\tape1:'
unix = `/dev/st1'
fbinary = 0x00000000
fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
(default) = `\\.\tape0:'
unix = `/dev/st0'
fbinary = 0x00000000
fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
(default) = `\\.\b:'
unix = `/dev/fd1'
fbinary = 0x00000000
fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
(default) = `\\.\a:'
unix = `/dev/fd0'
fbinary = 0x00000000
fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
(default) = `C:'
unix = `/'
fbinary = 0x00000000
fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\Cygnus Solutions
(default) = (unsupported type)
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
(default) = `C:/cygwin'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
(default) = `C:/cygwin/bin'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
(default) = `C:/cygwin/lib'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\05
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\06
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\07
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\08
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\09
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0E
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0F
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\10
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\11
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\12
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\13
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\14
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\15
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\16
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\17
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\18
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\19
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1D
a: fd N/A N/A
c: hd NTFS 9538Mb 55% CP CS UN PA FC Win2K
d: cd N/A N/A
e: cd CDFS 643Mb 100% CS TN0106
f: hd FAT32 1029Mb 17% CP UN
g: hd NTFS 9993Mb 18% CP CS UN PA FC Data Volume
h: net NTFS 18648Mb 50% CP CS PA .
k: net NTFS 29329Mb 59% CP CS UN PA FC your_way
c: /c user textmode
k: /k user textmode
. /cygdrive user binmode,noumount
C:/cygwin / system binmode
C:/cygwin/bin /usr/bin system binmode
C:/cygwin/lib /usr/lib system binmode
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\sh.exe
56k 2000/12/03 C:\cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
"cygbz21.0.dll" v0.0 ts=2000/11/20 17:53
45k 2001/04/25 C:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
"cygform5.dll" v0.0 ts=2001/4/25 0:28
34k 2001/09/30 C:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
"cygform6.dll" v0.0 ts=2001/9/29 21:43
18k 2000/10/23 C:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
"cyggdbm.dll" v0.0 ts=2000/10/22 21:26
17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
"cyghistory4.dll" v0.0 ts=2001/1/6 22:34
21k 2001/06/28 C:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
"cyghistory5.dll" v0.0 ts=2001/6/27 21:27
21k 2001/06/20 C:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
"cygintl.dll" v0.0 ts=2001/6/20 12:09
81k 2001/10/20 C:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
"cygitcl30.dll" v0.0 ts=2001/10/19 19:25
35k 2001/10/20 C:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
"cygitk30.dll" v0.0 ts=2001/10/19 19:25
45k 2001/07/04 C:\cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
"cygjbig1.dll" v0.0 ts=2001/7/3 22:25
119k 2001/06/06 C:\cygwin\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0
"cygjpeg6b.dll" v0.0 ts=2001/6/5 23:27
26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
"cygmenu5.dll" v0.0 ts=2001/4/25 0:27
19k 2001/09/30 C:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
"cygmenu6.dll" v0.0 ts=2001/9/29 21:43
156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
"cygncurses++5.dll" v0.0 ts=2001/4/25 0:29
175k 2001/09/30 C:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
"cygncurses++6.dll" v0.0 ts=2001/9/29 21:45
226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
"cygncurses5.dll" v0.0 ts=2001/4/25 0:17
201k 2001/09/30 C:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
"cygncurses6.dll" v0.0 ts=2001/9/29 21:42
15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
"cygpanel5.dll" v0.0 ts=2001/4/25 0:27
12k 2001/09/30 C:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
"cygpanel6.dll" v0.0 ts=2001/9/29 21:43
163k 2001/05/06 C:\cygwin\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0
"cygpng2.dll" v0.0 ts=2001/5/5 23:05
108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
"cygreadline4.dll" v0.0 ts=2001/1/6 22:34
135k 2001/06/28 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
"cygreadline5.dll" v0.0 ts=2001/6/27 21:27
390k 2001/10/20 C:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
"cygtcl80.dll" v0.0 ts=2001/10/19 19:24
5k 2001/10/20 C:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
10k 2001/10/20 C:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
"cygtclreg80.dll" v0.0 ts=2001/10/19 19:24
245k 2001/06/12 C:\cygwin\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0
"cygtiff3.dll" v0.0 ts=2001/6/12 12:25
623k 2001/10/20 C:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
"cygtk80.dll" v0.0 ts=2001/10/19 19:25
41k 2001/07/04 C:\cygwin\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0
"cygXpm-noX4.dll" v0.0 ts=2001/7/3 20:21
45k 2001/07/04 C:\cygwin\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0
"cygXpm-X4.dll" v0.0 ts=2000/11/19 20:45
49k 2001/02/03 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
"cygz.dll" v0.0 ts=2001/2/3 14:35
714k 2001/11/12 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
"cygwin1.dll" v0.0 ts=2001/11/11 18:01
Cygwin DLL version info:
DLL version: 1.3.5
DLL epoch: 19
DLL bad signal mask: 19005
DLL old termios: 5
DLL malloc env: 28
API major: 0
API minor: 47
Shared data: 3
DLL identifier: cygwin1
Mount registry: 2
Cygnus registry name: Cygnus Solutions
Cygwin registry name: Cygwin
Program options name: Program Options
Cygwin mount registry name: mounts v2
Cygdrive flags: cygdrive flags
Cygdrive prefix: cygdrive prefix
Cygdrive default prefix:
Build date: Sun Nov 11 19:01:54 EST 2001
Shared id: cygwin1S3
Cygwin Package Information
Last downloaded files to:
Last downloaded files from: ftp://mirrors.rcn.net/mirrors/sources.redhat.com/cygwin
Package Version
ash 20011018-1
autoconf 2.52-1
automake 1.5-1
bash 2.05-8
binutils 20011002-1
bison 1.28-1
byacc 0.0
bzip2 1.0.1-6
clear 1.0
cpio 2.4.2
cron 3.0.1-5
crypt 1.0-1
ctags 5.0.1-1
cvs 1.11.0-1
cygrunsrv 0.94-2
cygwin 1.3.5-1
cygwin-src 1.3.5-1
dejagnu 20010117-1
diff 0.0
expect 20010117-1
file 3.33-1
fileutils 4.1-1
findutils 0.0
flex 2.5.4-1
gawk 3.0.4-1
gcc 2.95.3-5
gdb 20010428-3
gdbm 1.8.0-3
gettext 0.10.38-2
ghostscript 6.51-1
gperf 0.0
grep 2.4.2-1
groff 1.16.1-1
gzip 1.3-1
inetutils 1.3.2-15
irc 20010101-1
jbigkit 1.2-4
jpeg 6b-4
less 358-3
libncurses5 5.2-1
libncurses6 5.2-2
libpng 1.0.11-1
login 1.4-2
lynx 2.8.4-1
m4 0.0
make 3.79.1-4
man 1.5g-2
mingw 20010917-1
mingw-runtime 1.1-1
mt 1.9.2-1
mutt 1.2.5i-5
ncftp 3.0.2-2
ncurses 5.2-7
newlib-man 20001118-1
opengl 1.1.0-5
openssh 3.0p1-1
openssl 0.9.6b-1
patch 2.5-2
pcre 3.4-2
perl 5.6.1-1
popt 1.6.1-1
postgresql 7.1.3-1
python 2.1.1-2
readline 4.2-3
regex 4.4
rsync 2.4.6-2
rxvt 2.7.2-6
sed 3.02-1
sh-utils 2.0-2
squid 2.4-STABLE20010508
ssmtp 2.38.7-3
tar 1.13.19-1
tcltk 20001125-1
tcsh 6.10.00-3
termcap 20010825-1
terminfo 5.2-1
tetex-beta 20001218-1
texinfo 4.0-4
textutils 2.0.16-1
tiff 3.5.6beta-2
time 1.7-1
unzip 5.41-1
vim 6.0.93-1
w32api 1.1-1
wget 1.7-1
which 1.4
xpm 4.0.0-2
xpm-nox 4.1.0-1
zip 2.3-1
zlib 1.1.3-6
Use -h to see help about each section
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
[-- Attachment #4: Type: text/plain, Size: 214 bytes --]
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATHC] Re: 1.3.5: write(2) system call fails with 0 length
2001-11-11 8:26 ` Pavel Tsekov
@ 2001-11-11 8:26 ` Pavel Tsekov
2001-11-11 8:26 ` Corinna Vinschen
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Tsekov @ 2001-11-11 8:26 UTC (permalink / raw)
To: cygwin, cygwin-patches
There was no feedback on this so I post again :) Is this
cygwin behaviour the expected behaviour ?
Pavel Tsekov wrote:
>
> Shun-ichi GOTO wrote:
> >
> > >>>>> at Tue, 13 Nov 2001 21:58:32 -0600
> > >>>>> Randy Reitz <rreitz@mssinternet.com> said,>
> >
> > > Here is a test program....
> >
> > It's strange test.
> > Do like this, and get result: "2nd write() failed: Bad address".
> > So you should give valid pointer as 2nd argument of 2nd write() call.
> > for example, write (fd, buf, 0);
> >
>
> It's not so strange if you think about it :) If a length of 0 is given
> there is no reason to check the pointer for being valid IMO.
>
> However here is what the linux man page says about write - havent
> checked
> any other source which may be more confident though:
>
> RETURN VALUE
> On success, the number of bytes written are returned (zero
> indicates nothing was written).
> On error, -1 is returned, and errno is set appropriately. If
> count is zero and the file
> descriptor refers to a regular file, 0 will be returned without
> causing any other effect.
> For a special file, the results are not portable.
>
> So at least linux just checks for valid fd when the len is 0.
>
> And the testcase which Randy posted is just fine when run on Linux of
> course
> if the file exists.
>
> [ptsekov@enigma Src]$ ~/Src/write_test
> ret=0, errno=0
>
> If the file does not exists at the time the testcase is run i get:
>
> [ptsekov@enigma Src]$ ~/Src/write_test
> ret=-1, errno=9 (Bad file descriptor)
>
> Attached is a simple patch which moves the buffer check after the
> check for valid file descriptor and the check for zero len.
>
> 2001-11-14 Pavel Tsekov <ptsekov@syntrex.com>
>
> * syscalls.cc (_write): Check if the third argument of _write() is zero.
> If the first argument of _write() is a valid file descriptor and the
> third
> argument is zero - return 0 without doing anything else.
> Perform a validation check on the second argument of _write() only if
> the
> _write() is requested on a valid file descriptor and the length of the
> buffer being written is not zero.
>
> ------------------------------------------------------------------------
> --- syscalls.cc.ORIG Wed Nov 14 10:33:03 2001
> +++ syscalls.cc Wed Nov 14 10:36:41 2001
> @@ -355,15 +355,21 @@ _read (int fd, void *ptr, size_t len)
> extern "C" ssize_t
> _write (int fd, const void *ptr, size_t len)
> {
> - if (__check_invalid_read_ptr_errno (ptr, len))
> - return -1;
> -
> int res = -1;
>
> sigframe thisframe (mainthread);
> cygheap_fdget cfd (fd);
> if (cfd < 0)
> goto done;
> +
> + if (len == 0)
> + {
> + res = 0;
> + goto done;
> + }
> +
> + if (__check_invalid_read_ptr_errno (ptr, len))
> + return -1;
>
> /* Could block, so let user know we at least got here. */
> if (fd == 1 || fd == 2)
>
> ------------------------------------------------------------------------
> --
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2001-11-15 12:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-02 11:28 1.3.5: write(2) system call fails with 0 length Randy Reitz
2001-11-02 11:44 ` Shun-ichi GOTO
2001-11-11 8:26 ` Pavel Tsekov
2001-11-11 8:26 ` [PATHC] " Pavel Tsekov
2001-11-11 8:26 ` Corinna Vinschen
2001-11-11 8:26 ` Pavel Tsekov
2001-11-11 8:26 ` Shun-ichi GOTO
2001-11-11 8:26 ` Randy Reitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).