SHA256
1
0
forked from pool/schily
schily/schily-2018-05-25_star_lock.patch
Jan Engelhardt 214927d25b Accepting request 614590 from home:kstreitova:branches:utilities
- add patches from the star package
  * schily-2018-05-25_star_configuration.patch
  * schily-2018-05-25_star_no_fsync.patch
  * schily-2018-05-25_star_lock.patch
  * schily-2018-05-25_star_detect_gzip_failures.patch
  * schily-2018-05-25_star_bufferoverflow.patch
  * schily-2018-05-25_star_use_ssh_by_default.patch
  * schily-2018-05-25_star_selinux.patch
- add missing BuildRequires for star:
  * autoconf (because of selinux patch)
  * libacl-devel
  * libattr-devel
  * libselinux-devel
  * libtool
- install README-FIRST (as schily-rmt) documentation
- add noreplace for %_sysconfdir/default/rmt and
  %_sysconfdir/default/star
- move srmt from sbindir to bindir
- do not ship star_sym and suntar

OBS-URL: https://build.opensuse.org/request/show/614590
OBS-URL: https://build.opensuse.org/package/show/utilities/schily?expand=0&rev=27
2018-06-06 14:57:44 +00:00

49 lines
1.1 KiB
Diff

Index: schily-2018-05-25/star/fifo.c
===================================================================
--- schily-2018-05-25.orig/star/fifo.c
+++ schily-2018-05-25/star/fifo.c
@@ -487,13 +487,42 @@ LOCAL int
swait(f)
int f;
{
- int ret;
+ int ret, err;
unsigned char c;
+ struct flock lock;
+ useconds_t wait;
+
+ wait = 500000;
+ lock.l_type = F_RDLCK;
+ lock.l_whence = SEEK_CUR;
+ lock.l_start = 0;
+ lock.l_len = 0;
+ do {
+ err = fcntl(f, F_SETLK, &lock);
+ if (err < 0) {
+ err = geterrno();
+ if (err == EINTR)
+ continue;
+ if ((err == EACCES || err == EAGAIN) && (wait > 0)) {
+ usleep(10000);
+ wait -= 10000;
+ continue;
+ }
+ errmsg("Can not get lock on semaphore wait for file descriptor\n");
+ exprstats(-1);
+ }
+ } while (0);
seterrno(0);
do {
ret = read(f, &c, 1);
} while (ret < 0 && geterrno() == EINTR);
+
+ lock.l_type = F_UNLCK;
+ do {
+ err = fcntl(f, F_SETLK, &lock);
+ } while (err < 0 && geterrno() == EINTR);
+
if (ret < 0 || (ret == 0 && pid)) {
/*
* If pid != 0, this is the foreground process