comparison remap.c @ 371:587353009f65 src

replace an assert(getenv("HOME)) with a return NULL in cases when $HOME is not defined, as in the case of windows. Patch by Rafael Carr (funman videolan org)
author nicodvb
date Thu, 05 Jun 2008 08:55:12 +0000
parents 83758bfacd4c
children 5820649e5aa2
comparison
equal deleted inserted replaced
370:d80a041928be 371:587353009f65
33 #ifndef MAXPATHLEN 33 #ifndef MAXPATHLEN
34 #define MAXPATHLEN 255 34 #define MAXPATHLEN 255
35 #endif 35 #endif
36 #endif /* _MSC_VER */ 36 #endif /* _MSC_VER */
37 37
38 #include <assert.h>
39 #include <inttypes.h> 38 #include <inttypes.h>
40 #include <limits.h> 39 #include <limits.h>
41 #include <sys/time.h> 40 #include <sys/time.h>
42 #include "dvd_types.h" 41 #include "dvd_types.h"
43 #include "nav_types.h" 42 #include "nav_types.h"
200 FILE *fp; 199 FILE *fp;
201 block_t tmp; 200 block_t tmp;
202 remap_t *map; 201 remap_t *map;
203 202
204 /* Build the map filename */ 203 /* Build the map filename */
205 home = getenv("HOME"); assert(home); 204 home = getenv("HOME");
205 if(!home) {
206 fprintf(MSG_OUT, "libdvdnav: Unable to find home directory" );
207 return NULL;
208 }
206 snprintf(fname, sizeof(fname), "%s/.dvdnav/%s.map", home, title); 209 snprintf(fname, sizeof(fname), "%s/.dvdnav/%s.map", home, title);
207 210
208 /* Open the map file */ 211 /* Open the map file */
209 fp = fopen( fname, "r"); 212 fp = fopen( fname, "r");
210 if (!fp) { 213 if (!fp) {