mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
sysutils/fcron: fixup default argument promotion
When mode_t is char- or short-like, it will be promoted to the pure int when it is passed as the variable argument [1], so we should pass 'int' to the va_arg. I had also eliminated fflush for the stream opened read-only, since it will always fail and there is no need to flush read-only streams. [1] http://c-faq.com/~scs/cclass/int/sx11c.html Feature safe: yes PR: 152304
This commit is contained in:
parent
369c12167b
commit
4839c29cd1
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=282355
3 changed files with 44 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
PORTNAME= fcron
|
||||
PORTVERSION= 3.0.6
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= ${MASTER_SITE_SUNSITE} \
|
||||
http://fcron.free.fr/archives/ \
|
||||
|
|
15
sysutils/fcron/files/patch-fileconf.c
Normal file
15
sysutils/fcron/files/patch-fileconf.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
We don't need to fflush the file, since it is opened read-only.
|
||||
|
||||
--- fileconf.c.orig 2011-07-18 19:55:28.726082293 +0400
|
||||
+++ fileconf.c 2011-07-18 19:55:37.988079816 +0400
|
||||
@@ -264,10 +264,6 @@
|
||||
cf->cf_next = file_base;
|
||||
file_base = cf;
|
||||
|
||||
- /* don't close as underlying fd may still be used by calling function */
|
||||
- if (fflush(file) != 0)
|
||||
- error_e("could not fflush() file_name");
|
||||
-
|
||||
free(default_line.cl_runas);
|
||||
free(default_line.cl_mailto);
|
||||
free(default_line.cl_tz);
|
28
sysutils/fcron/files/patch-subs.c
Normal file
28
sysutils/fcron/files/patch-subs.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
--- subs.c.orig 2011-07-18 17:28:21.745080904 +0400
|
||||
+++ subs.c 2011-07-18 19:39:18.999087202 +0400
|
||||
@@ -121,7 +121,11 @@
|
||||
|
||||
if (flags & O_CREAT) {
|
||||
va_start(ap, flags);
|
||||
- mode = va_arg(ap, mode_t);
|
||||
+ /* Beware: default argument promotion. */
|
||||
+ if (sizeof(int) > sizeof(mode_t))
|
||||
+ mode = va_arg(ap, int);
|
||||
+ else
|
||||
+ mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
@@ -179,7 +183,11 @@
|
||||
|
||||
if (flags & O_CREAT) {
|
||||
va_start(ap, flags);
|
||||
- mode = va_arg(ap, mode_t);
|
||||
+ /* Beware: default argument promotion. */
|
||||
+ if (sizeof(int) > sizeof(mode_t))
|
||||
+ mode = va_arg(ap, int);
|
||||
+ else
|
||||
+ mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue