void-packages/srcpkgs/pilot-link/patches/fix-unused_result.patch
Đoàn Trần Công Danh 49cb564d14 srcpkgs/p*: convert patches to -Np1
* par is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

41 lines
1.2 KiB
Diff

--- a/libpisock/serial.c 2006-10-12 16:21:22.000000000 +0200
+++ b/libpisock/serial.c 2016-12-20 14:38:46.477854828 +0100
@@ -364,6 +364,7 @@
begin:
if ((err = data->impl.open(ps, pa, addrlen)) < 0) {
int save_errno = errno;
+ char* result = NULL;
#ifdef MAXPATHLEN
char realport[MAXPATHLEN];
#else
@@ -374,8 +375,10 @@
# endif /* PATH_MAX */
#endif /* MAXPATHLEN */
- realpath(pa->pi_device, realport);
+ result = realpath(pa->pi_device, realport);
errno = save_errno;
+ if (result == NULL)
+ result == realport;
if (errno == ENOENT) {
LOG((PI_DBG_DEV, PI_DBG_LVL_ERR,
--- a/src/pilot-foto-treo600.c 2009-06-04 15:32:30.000000000 +0200
+++ b/src/pilot-foto-treo600.c 2016-12-20 15:24:35.897251325 +0100
@@ -86,8 +86,14 @@
}
if (req_uid && uid == req_uid) {
- memcpy(&req_uid, Pbuf, 4); /* get next req_uid for image 'block' */
- write(fd, Pbuf + 4, size - 4); /* The rest is just jpeg data */
+ size_t done;
+ memcpy(&req_uid, Pbuf, 4); /* get next req_uid for image 'block' */
+ done = write(fd, Pbuf + 4, size - 4); /* The rest is just jpeg data */
+ if (done != size - 4) {
+ fprintf(stderr," ERROR: Error writing '%s' size %d\n\n",
+ imgfilename, size - 4);
+ return -1;
+ }
}
}