galeb

Једноставна статичка дистрибуција заснована на musl-у
git clone https://git.sr.ht/~strahinja/galeb
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

reopen_after_editfile.patch (579B)


      1 --- crontab.c	2011-05-01 14:22:09.000000000 +0200
      2 +++ crontab.c	2022-07-17 15:31:30.188117594 +0200
      3 @@ -176,9 +176,15 @@
      4  						while ((n = fread(buf, 1, sizeof(buf), fi)) > 0)
      5  							write(fd, buf, n);
      6  					}
      7 +					/*
      8 +					 * In my testing, on musl, file state is
      9 +					 * not updated after EditFile, so
     10 +					 * reopening is needed. - [SR]
     11 +					 **/
     12 +					close(fd);
     13  					EditFile(caller, tmp);
     14 +					fd = open(tmp, O_RDWR, 0);
     15  					remove(tmp);
     16 -					lseek(fd, 0L, 0);
     17  					repFd = fd;
     18  				} else {
     19  					printlogf(0, "unable to create %s: %s", tmp, strerror(errno));