Andrew Wood
69a56ced7a
Correct double-free on exit when using --watchfd - issue #96 .
2024-09-07 21:04:09 +01:00
Andrew Wood
60936080da
Move the "--size @FILE" file size reading into its own function for clarity; standardise its error message format to "program: file: message: detail"; uniquely name variables; refuse to accept a directory as a file; and with this option, try reading the size of a block device from sysfs if we can, to avoid requiring read permissions on the device.
2024-08-06 23:17:15 +01:00
Alexander Perlis
f6b0ddc0b3
Support block devices in @-syntax
2024-08-01 00:36:02 +00:00
Andrew Wood
e4ab8c56a0
Minor adjustment to comments.
2024-07-17 07:41:48 +01:00
Eric A. Borisch
3fdfd07443
Improve description and comments for blocking-write() after select()
2024-07-16 23:39:15 -05:00
Andrew Wood
d801cdd722
Remove spurious strerror() call from debug report.
2024-07-16 22:44:10 +01:00
Andrew Wood
72e5078ce9
Move the MAKE_OUTPUT_NONBLOCKING code to state.c, as it can no longer work in main.c due to accessing internal structures; but still leave it switched off by default for now.
2024-07-16 22:41:31 +01:00
Andrew Wood
a7c3f3dd35
Write the error from write() to the debugging output if nwritten is <0.
2024-07-16 22:23:51 +01:00
Andrew Wood
12f0312b00
Move the "stop at size" option setting to before the size calculation, otherwise if the size calculation tries to override that setting, it cannot do so ( #91 ).
2024-07-16 21:58:47 +01:00
Andrew Wood
8c0e3e9dad
When checking how many bytes were written, place the constant to the left of the equality check to match the rest of the code (this avoids accidental assignment if one equals sign is accidentally written instead of two), and write the appropriate debug message depending on whether the write was interrupted or it was empty.
2024-07-16 21:54:13 +01:00
Andrew Wood
c7104f0c0d
Merge pull request 'src/pv/transfer.c: timer going off returns with total_written==0; which is not an error.' ( #92 ) from eborisch/pv:write-can-return-0 into main
...
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/92
2024-07-16 20:47:32 +00:00
Andrew Wood
f8fc5844b1
Re-order the output file descriptor setting and the size detection to correct the problem with output block device size detection that was broken in 1.8.10 ( #91 ).
2024-07-16 21:39:29 +01:00
eborisch
d86d8cf65a
Clarify state.
2024-07-16 03:57:11 +00:00
eborisch
11e5b5fe95
src/pv/transfer.c: write(2) returning 0 is not an error
...
This is being hit easily on FreeBSD with pv sitting in a zfs send/recv pipeline. As write(2) returning 0 is not an error, handle it similar to returning -1 with EINTR or EAGAIN: wait a bit and try again.
2024-07-15 21:36:57 +00:00
Andrew Wood
2bed6776e4
Truncate files written with "-o".
2024-06-08 22:02:11 +01:00
Andrew Wood
01e0290d6e
More replacement of hard-coded exit status bitmask values with named constants.
2024-06-08 21:57:36 +01:00
Andrew Wood
1c61154206
Replace hard-coded exit status bitmask values with named constants.
2024-06-08 21:49:46 +01:00
Andrew Wood
addf25ff16
Minor cleanups after merge.
2024-06-08 21:21:11 +01:00
Martin Dørum
6073445551
document the --output in the man page and help text
2024-06-08 14:31:21 +02:00
Martin Dørum
30763684b7
add -o/--output option
2024-06-08 14:31:19 +02:00
Andrew Wood
ace8f44f59
Added more debugging to stdout writes.
2024-05-11 21:13:12 +01:00
Andrew Wood
98994bbeaa
Correct the copyright year in the "--version" output.
2024-04-22 22:25:22 +01:00
Andrew Wood
b375041790
Correct issues #34 , #86 , #87 - progress output stopping when writing output data blocks - by adding a SIGALRM handler, since ignoring the signal prevents it from interrupting writes; and use setitimer() where available, instead of alarm(), to provide sufficient granularity to handle the case where the --interval is not a whole number of seconds.
2024-04-21 13:54:01 +01:00
Andrew Wood
3a41665302
Fix incorrect "%lf" string format.
2024-04-21 12:02:35 +01:00
Andrew Wood
f6686b8188
Minor formatting changes by "indent".
2024-04-21 12:01:52 +01:00
Andrew Wood
a5700cc914
Reinstate the use of $TMPDIR and $TMP in cursor positioning rather than hard-coding "/tmp" ( #88 ).
2024-04-20 21:46:23 +01:00
Andrew Wood
d3c59cbff3
Minor comment formatting correction.
2024-04-20 21:31:17 +01:00
Andrew Wood
8bc1cc28d0
Check for zero-length $HOME and document the reason flawfinder's warning is being ignored.
2024-04-20 21:01:04 +01:00
Andrew Wood
1ad9c321bc
Adjust copyright years.
2024-03-19 22:19:42 +00:00
Andrew Wood
c9dede08d4
Adjust the decimal units flag variable name from "si" to "decimal_units" so it does not overlap with other words like "size" and "signal"; add man page entry and adjust the "-L" man page entry; and allow this flag to also change how input prefixes are processed.
2024-03-19 22:17:43 +00:00
kevinruddy
fe8137521a
Support for decimal SI units
2024-03-19 16:57:57 -04:00
Andrew Wood
cc9534fc7b
Cast of values for pv_snprintf() is required on Cygwin.
2023-11-19 16:39:32 +00:00
Andrew Wood
3eee7a1409
Addressed more issues raised by flawfinder.
2023-10-22 17:43:40 +01:00
Andrew Wood
e446782c1f
Addressed more issues raised by splint, and refactored out state_array so that state is part of info_array and each state is allocated and deallocated properly instead of referencing pointers multiple times.
2023-10-22 16:23:53 +01:00
Andrew Wood
d06374a0f1
Addressed more issues raised by splint and flawfinder.
2023-10-22 00:08:35 +01:00
Andrew Wood
9a9c117411
Addressed more issues raised by flawfinder.
2023-10-18 23:10:29 +01:00
Andrew Wood
be4402c1ff
Addressed more issues raised by flawfinder.
2023-10-17 22:09:04 +01:00
Andrew Wood
4d46dbe545
Comment wording correction.
2023-10-17 21:02:21 +01:00
Andrew Wood
3fdf8d5a69
Improved comments.
2023-10-16 22:47:02 +01:00
Andrew Wood
b4d6c5ed2a
Addressed more issues raised by splint, and improved variable names and comments.
2023-10-15 23:42:04 +01:00
Andrew Wood
d8e0674da0
Move locally scoped variables from "switch" statement into outer "for" loop, to avoid triggering a crash in the "splint" code analyser.
2023-10-15 22:29:37 +01:00
Andrew Wood
b0df2e53a8
Replace str_* in state structure with an array of components of enumerated types, to avoid pointers everywhere in the format array and to allow for later expansion which will separate "string length" from "displayed width" to allow for wide character support.
2023-10-14 17:18:20 +01:00
Andrew Wood
94ffdaf60d
Group state structure into sub-structures to allow future changes to watchpid code that will do a better job of duplicating the relevant parts of the internal state for each fd.
2023-10-14 01:23:54 +01:00
Andrew Wood
7fcc7af07d
Addressed more issues raised by flawfinder.
2023-10-14 00:04:56 +01:00
Andrew Wood
03d42555e7
Addressed more issues raised by splint.
2023-10-14 00:04:24 +01:00
Andrew Wood
41b223a757
Addressed more issues raised by splint.
2023-10-13 23:31:28 +01:00
Andrew Wood
03fb1dc673
Correct percentage formatting so it is always 3 characters wide.
2023-10-11 22:22:53 +01:00
Andrew Wood
e864eca78d
Only check for the IPC functions we are still using.
2023-10-01 15:16:31 +01:00
Andrew Wood
dbf55eff3c
For message passing for "--remote", fall back to $HOME/.pv instead of /tmp if /run/user/<uid> is unavailable.
2023-10-01 12:41:27 +01:00
Andrew Wood
07f894f66c
Minor formatting change from "indent".
2023-10-01 12:40:22 +01:00