summaryrefslogtreecommitdiff
path: root/debian/patches/0105-artec_missing_home_environment.patch
blob: 66021646063e305147e2b06d913647108a8ff591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Description: Test if  environment variable "HOME" exist
Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=786452
Forwarded: https://alioth.debian.org/tracker/index.php?func=detail&aid=315071&group_id=30186&atid=410366
Last-Update: 2015-05-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: trunk/backend/artec_eplus48u.c
===================================================================
--- trunk.orig/backend/artec_eplus48u.c
+++ trunk/backend/artec_eplus48u.c
@@ -3580,6 +3580,14 @@ load_calibration_data (Artec48U_Scanner
 
   s->calibrated = SANE_FALSE;
   path[0] = 0;
+
+  /* return SANE_STATUS_INVAL if HOME environment variable is not set */
+  if (getenv ("HOME") == NULL)
+  {
+    XDBG ((1, "Environment variable HOME not set\n"));
+    return SANE_STATUS_INVAL;
+  }
+
   if (strlen (getenv ("HOME")) < (PATH_MAX - 1))
     strcat (path, getenv ("HOME"));
   else
@@ -3690,6 +3698,14 @@ save_calibration_data (Artec48U_Scanner
   mode_t mode = S_IRUSR | S_IWUSR;
 
   path[0] = 0;
+
+  /* return SANE_STATUS_INVAL if HOME environment variable is not set */
+  if (getenv ("HOME") == NULL)
+  {
+    XDBG ((1, "Environment variable HOME not set\n"));
+    return SANE_STATUS_INVAL;
+  }
+
   if (strlen (getenv ("HOME")) < (PATH_MAX - 1))
     strcat (path, getenv ("HOME"));
   else