mirror of
https://repo.or.cz/socat.git
synced 2025-07-14 15:23:24 +00:00
handle partial write()'s without data loss
This commit is contained in:
parent
3881c794a7
commit
6a8f6c0734
9 changed files with 114 additions and 47 deletions
|
@ -1,5 +1,5 @@
|
|||
/* source: xiolockfile.c */
|
||||
/* Copyright Gerhard Rieger 2005-2006 */
|
||||
/* Copyright Gerhard Rieger 2005-2011 */
|
||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||
|
||||
/* this file contains socats explicit locking mechanisms */
|
||||
|
@ -52,7 +52,10 @@ int xiogetlock(const char *lockfile) {
|
|||
|
||||
pid = Getpid();
|
||||
bytes = sprintf(pidbuf, F_pid, pid);
|
||||
Write(fd, pidbuf, bytes);
|
||||
if (writefull(fd, pidbuf, bytes) < 0) {
|
||||
Error4("write(%d, %p, "F_Zu"): %s", fd, pidbuf, bytes, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
Close(fd);
|
||||
|
||||
/* Chmod(lockfile, 0600); */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue