tslib: Set open mode for ts_calibate.c

Get patch from: http://permalink.gmane.org/gmane.comp.lib.uclibc.buildroot/27614

There is a potentially "unsafe" use of open(). Ubuntu 8.10+, for instance,
by default enables the compiler flag -D_FORTIFY_SOURCE=2 \
which throws an error of ts_calibrate.c. To fix this, \
set a mode in the open() call, patch patched ts_calibrate.c \
to set 0644 (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) and it compiles fine

(From OE-Core rev: 61928384b91f7328aaa72c6d1299d8598c24574d)

Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Xiaofeng Yan 2011-11-17 19:03:21 +08:00 committed by Richard Purdie
parent 32ee632295
commit e04de73421
2 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1,30 @@
Get patch from: http://permalink.gmane.org/gmane.comp.lib.uclibc.buildroot/27614
Upstream-Status: Inappropriate [configuration]
diff --git a/tests/ts_calibrate.c b/tests/ts_calibrate.c
index 004517b..c0a9771 100644
--- a/tests/ts_calibrate.c
+++ b/tests/ts_calibrate.c
@@ -21,6 +21,7 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
+#include <sys/stat.h>
#include <linux/kd.h>
#include <linux/vt.h>
#include <linux/fb.h>
@@ -224,9 +225,11 @@ int main()
for (i = 0; i < 7; i++) printf("%d ", cal.a [i]);
printf("\n");
if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
- cal_fd = open (calfile, O_CREAT | O_RDWR);
+ cal_fd = open (calfile, O_CREAT | O_RDWR,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
} else {
- cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR);
+ cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
}
sprintf (cal_buffer,"%d %d %d %d %d %d %d",
cal.a[1], cal.a[2], cal.a[0],

View File

@ -10,13 +10,14 @@ SECTION = "base"
LICENSE = "LGPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=f30a9716ef3762e3467a2f62bf790f0a"
PR = "r19"
PR = "r20"
SRC_URI = "http://download.berlios.de/tslib/tslib-${PV}.tar.bz2 \
file://fix_version.patch \
file://0001-Link-plugins-against-libts.patch \
file://ts.conf \
file://tslib.sh"
file://tslib.sh \
file://set-open-mode-for-ts_calibrate_c.patch"
SRC_URI[md5sum] = "92b2eb55b1e4ef7e2c0347069389390e"
SRC_URI[sha256sum] = "9c40d914e4f6fe00bdd77137d671c7ce4f211686228f2eb8b2d3c2360bc249c8"