2008-06-06 09:45:56 +02:00
|
|
|
$NetBSD: patch-ab,v 1.5 2008/06/06 07:45:56 dsainty Exp $
|
2006-01-13 00:49:58 +01:00
|
|
|
|
2006-05-07 05:16:48 +02:00
|
|
|
Purge the unnecessary complication of PID_FORMAT, and add NetBSD support. Use
|
|
|
|
OSS for sound for NetBSD, because the Sun support is a bit too Sun-centric.
|
|
|
|
|
2008-06-06 09:45:56 +02:00
|
|
|
--- xbsndsrv.c.orig 2008-05-29 03:32:37.000000000 +1200
|
|
|
|
+++ xbsndsrv.c 2008-05-29 03:37:13.000000000 +1200
|
|
|
|
@@ -48,8 +48,6 @@
|
|
|
|
|
|
|
|
#ifdef __sun__
|
2006-05-07 05:16:48 +02:00
|
|
|
|
|
|
|
-/* format for pids on sun */
|
|
|
|
-#define PID_FORMAT "%lu"
|
|
|
|
/* needed for bzero(), open()*/
|
|
|
|
#include <strings.h>
|
|
|
|
#include <fcntl.h>
|
2008-06-06 09:45:56 +02:00
|
|
|
@@ -63,8 +61,6 @@
|
|
|
|
|
2006-05-07 05:16:48 +02:00
|
|
|
#else
|
2008-06-06 09:45:56 +02:00
|
|
|
|
2006-05-07 05:16:48 +02:00
|
|
|
-/* format for pids, non-sun */
|
|
|
|
-#define PID_FORMAT "%u"
|
|
|
|
/* non-sun audio includes */
|
2008-06-06 09:45:56 +02:00
|
|
|
#ifdef HAVE_SYS_SOUNDCARD_H
|
|
|
|
#include <sys/soundcard.h>
|
|
|
|
@@ -550,17 +546,17 @@
|
|
|
|
ptr = fopen (userPath, "r+");
|
|
|
|
if (ptr == NULL) {
|
|
|
|
ptr = fopen (userPath, "w+");
|
|
|
|
- sprintf (tmp, PID_FORMAT, getpid ());
|
|
|
|
+ sprintf (tmp, "%u", (unsigned int)getpid ());
|
|
|
|
fwrite (tmp, 1, strlen (tmp), ptr);
|
|
|
|
fclose (ptr);
|
|
|
|
return 0;
|
1998-11-10 09:32:36 +01:00
|
|
|
|
2008-06-06 09:45:56 +02:00
|
|
|
}
|
|
|
|
- fscanf (ptr, PID_FORMAT, &pid);
|
|
|
|
- fprintf (stderr, " " PID_FORMAT " \n", pid);
|
|
|
|
+ fscanf (ptr, "%u", &pid);
|
|
|
|
+ fprintf (stderr, " %u \n", pid);
|
|
|
|
if (kill (pid, 0) == -1 || pid <= 0) {
|
|
|
|
fseek (ptr, 0, SEEK_SET);
|
|
|
|
- sprintf (tmp, PID_FORMAT, getpid ());
|
|
|
|
+ sprintf (tmp, "%u", (unsigned int)getpid ());
|
|
|
|
fwrite (tmp, 1, strlen (tmp), ptr);
|
|
|
|
fclose (ptr);
|
|
|
|
return 0;
|