Package: scanbuttond
Version: 0.2.3-6
Severity: important
I tried to run scanbuttond from udev by appending
, RUN+="/usr/bin/scanbuttond" to a rule in /etc/udev/libsane.rules. But the
program segfaults because the environment variable PATH is not set. I
attached a patch which corrects the problem.
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.24.7
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) (ignored:
LC_ALL set to [EMAIL PROTECTED])
Versions of packages scanbuttond depends on:
ii libc6 2.3.6.ds1-13etch5 GNU C Library: Shared libraries
ii libsane 1.0.18-5 API library for scanners
ii libusb-0.1-4 2:0.1.12-5 userspace USB programming library
Versions of packages scanbuttond recommends:
ii sane-utils 1.0.18-5 API library for scanners --
utilit
-- no debconf information
--- scanbuttond.c.orig 2008-06-03 22:11:00.000000000 +0200
+++ scanbuttond.c 2008-06-03 22:11:21.000000000 +0200
@@ -268,13 +268,23 @@ int main(int argc, char** argv)
// setup the environment
char* oldpath = getenv("PATH");
+ if (oldpath == NULL) {
+ oldpath = "";
+ }
char* dir = dirname(argv[0]);
path = (char*)malloc(strlen(oldpath) + strlen(dir) + 1);
- strcpy(path, oldpath);
- strcat(path, ":");
- strcat(path, dir);
- setenv("PATH", path, 1);
- free(path);
+ if (path) {
+ if (strlen(oldpath)) {
+ strcpy(path, oldpath);
+ strcat(path, ":");
+ }
+ else {
+ path[0] = 0;
+ }
+ strcat(path, dir);
+ setenv("PATH", path, 1);
+ free(path);
+ }
syslog(LOG_DEBUG, "running scanner initialization script...");
execute_and_wait(initscanner_script);