Only process the var_args argument to open() if flags contain O_CREAT.

This avoids a bus error crash when using esddsp.

PR:		80382
This commit is contained in:
Joe Marcus Clarke 2005-04-27 03:38:33 +00:00
parent e80c719a2e
commit fc0c338e9f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=134228
2 changed files with 19 additions and 1 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= esound
PORTVERSION= 0.2.35
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= audio
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/${PORTNAME}/0.2

View File

@ -0,0 +1,18 @@
--- esddsp.c.orig Tue Apr 26 22:41:23 2005
+++ esddsp.c Tue Apr 26 22:42:04 2005
@@ -223,9 +223,12 @@ open (const char *pathname, int flags, .
dsp_init ();
- va_start (args, flags);
- mode = va_arg (args, mode_t);
- va_end (args);
+ if ((flags & O_CREAT) != 0)
+ {
+ va_start (args, flags);
+ mode = va_arg (args, int);
+ va_end (args);
+ }
if (!strcmp (pathname, "/dev/dsp"))
{