| 1 | Description: Exit when there is no HOME environment variable |
| 2 | The home directory is used in multiple places without checking |
| 3 | whether it is non-NULL. I think that it is very unlikely for |
| 4 | someone to want to use this program without that variable in |
| 5 | the environment, so we just bail out if it is missing. |
| 6 | . |
| 7 | If anyone wants gtk-theme-switch2 to work without a HOME |
| 8 | environment variable, they will surely file a bug about this. |
| 9 | Author: Marius Gavrilescu <marius@ieval.ro> |
| 10 | Forwarded: no |
| 11 | Last-Update: 2013-07-13 |
| 12 | |
| 13 | --- a/main.c |
| 14 | +++ b/main.c |
| 15 | @@ -951,6 +951,11 @@ |
| 16 | newfont = 0; |
| 17 | execname = argv[0]; |
| 18 | homedir = getenv("HOME"); |
| 19 | + if(homedir == NULL) |
| 20 | + { |
| 21 | + fprintf(stderr, "No HOME variable in environment, bailing out\n"); |
| 22 | + return 0; |
| 23 | + } |
| 24 | hash = g_hash_table_new (g_str_hash, g_str_equal); |
| 25 | |
| 26 | if (argc == 1) /* start in dock mode auto if no args */ |