Install slaves to /usr/lib/osspd: They are not means to be called
[osspd.git] / debian / patches / 0004-Allow-to-set-slave-installation-path-during-compilat.patch
diff --git a/debian/patches/0004-Allow-to-set-slave-installation-path-during-compilat.patch b/debian/patches/0004-Allow-to-set-slave-installation-path-during-compilat.patch
new file mode 100644 (file)
index 0000000..654ff3b
--- /dev/null
@@ -0,0 +1,77 @@
+From: Ralf Jung <post@ralfj.de>
+Date: Wed, 19 Sep 2012 13:12:58 +0200
+Subject: Allow to set slave installation path during compilation
+
+Forwarded: not-needed
+---
+ Makefile |    8 +++++---
+ osspd.c  |   11 ++---------
+ 2 files changed, 7 insertions(+), 12 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 8d8fe87..236176e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -8,6 +8,7 @@ LDFLAGS := -L. -lossp $(LDFLAGS)
+ prefix := /usr/local
+ DESTDIR :=
+ UDEVDIR := /etc/udev/rules.d
++SLAVESDIR := $(prefix)/sbin
+ ifeq "$(origin OSSPD_CFLAGS)" "undefined"
+ OSSPD_CFLAGS := $(shell pkg-config --cflags fuse)
+@@ -38,8 +39,9 @@ headers := ossp.h ossp-util.h ossp-slave.h
+ all: osspd ossp-padsp ossp-alsap
+ install:
+-      mkdir -p $(DESTDIR)$(prefix)/sbin
+-      install -m755 osspd ossp-padsp ossp-alsap $(DESTDIR)$(prefix)/sbin
++      mkdir -p $(DESTDIR)$(prefix)/sbin $(DESTDIR)$(SLAVESDIR)
++      install -m755 osspd $(DESTDIR)$(prefix)/sbin
++      install -m755 ossp-padsp ossp-alsap $(DESTDIR)$(SLAVESDIR)
+       mkdir -p $(DESTDIR)$(UDEVDIR)
+       install -m644 98-osscuse.rules $(DESTDIR)$(UDEVDIR)
+@@ -50,7 +52,7 @@ libossp.a: ossp.c ossp.h ossp-util.c ossp-util.h ossp-slave.c ossp-slave.h
+       $(AR) rc $@ ossp.o ossp-util.o ossp-slave.o
+ osspd: osspd.c libossp.a $(headers)
+-      $(CC) $(CFLAGS) $(OSSPD_CFLAGS) -o $@ $< $(OSSPD_LDFLAGS) $(LDFLAGS)
++      $(CC) $(CFLAGS) $(OSSPD_CFLAGS) -DSLAVE_DEFAULT_PATH=\"$(SLAVESDIR)\" -o $@ $< $(OSSPD_LDFLAGS) $(LDFLAGS)
+ ossp-padsp: ossp-padsp.c libossp.a $(headers)
+       $(CC) $(CFLAGS) $(OSSP_PADSP_CFLAGS) -o $@ $< $(OSSP_PADSP_LDFLAGS) $(LDFLAGS)
+diff --git a/osspd.c b/osspd.c
+index 1dbe586..b318fc8 100644
+--- a/osspd.c
++++ b/osspd.c
+@@ -2005,7 +2005,7 @@ static const char *usage =
+ "    --max=MAX         maximum number of open streams (default 256)\n"
+ "    --umax=MAX        maximum number of open streams per UID (default --max)\n"
+ "    --exit-on-idle    exit if idle\n"
+-"    --dsp-slave=PATH  DSP slave (default ossp-padsp in the same dir)\n"
++"    --dsp-slave=PATH  DSP slave (default: " SLAVE_DEFAULT_PATH "/ossp-padsp)\n"
+ "    --log=LEVEL       log level (0..6)\n"
+ "    --timestamp       timestamp log messages\n"
+ "    -v                increase verbosity, can be specified multiple times\n"
+@@ -2175,19 +2175,12 @@ int main(int argc, char **argv)
+       if (sigaction(SIGPIPE, &sa, NULL))
+               fatal_e(-errno, "failed to ignore SIGPIPE");
+-      /* determine slave path and check for availability */
+-      ret = readlink("/proc/self/exe", path_buf, PATH_MAX - 1);
+-      if (ret < 0)
+-              fatal_e(-errno, "failed to determine executable path");
+-      path_buf[ret] = '\0';
+-      dir = dirname(path_buf);
+-
+       if (param.dsp_slave_path) {
+               strncpy(dsp_slave_path, param.dsp_slave_path, PATH_MAX - 1);
+               dsp_slave_path[PATH_MAX - 1] = '\0';
+       } else {
+               ret = snprintf(dsp_slave_path, PATH_MAX, "%s/%s",
+-                             dir, "ossp-padsp");
++                             SLAVE_DEFAULT_PATH, "ossp-padsp");
+               if (ret >= PATH_MAX)
+                       fatal("dsp slave pathname too long");
+       }