*p = '\0';
}
- getcwd(savecwd, sizeof(savecwd));
- if ((chdir(abspath)) < 0)
+ if (!getcwd(savecwd, sizeof(savecwd)) || chdir(abspath) < 0)
return NULL;
- getcwd(abspath, sizeof(abspath));
- chdir (savecwd);
-
+ if (!getcwd(abspath, sizeof(abspath)) || chdir (savecwd) < 0)
+ return NULL;
+
+
if (strlen(abspath) > bufsize)
return NULL;
switch (option) {
case MAC_CHARSET:
if ((vol->v_maccodepage = strdup(value)) == NULL) {
- fprintf (stderr, "strdup: %m");
+ fprintf (stderr, "strdup: %s", strerror(errno));
return -1;
}
break;
case VOL_CHARSET:
if ((vol->v_volcodepage = strdup(value)) == NULL) {
- fprintf (stderr, "strdup: %m");
+ fprintf (stderr, "strdup: %s", strerror(errno));
return -1;
}
break;
case CNIDBACKEND:
if ((vol->v_cnidscheme = strdup(value)) == NULL) {
- fprintf (stderr, "strdup: %m");
+ fprintf (stderr, "strdup: %s", strerror(errno));
return -1;
}
break;
case CNIDDBDHOST:
if ((vol->v_dbd_host = strdup(value)) == NULL) {
- fprintf (stderr, "strdup: %m");
+ fprintf (stderr, "strdup: %s", strerror(errno));
return -1;
}
break;
break;
case CNID_DBPATH:
if ((vol->v_dbpath = strdup(value)) == NULL) {
- fprintf (stderr, "strdup: %m");
+ fprintf (stderr, "strdup: %s", strerror(errno));
return -1;
}
break;
return -1;
if ((vol->v_path = strdup(volinfofile)) == NULL ) {
- fprintf (stderr, "strdup: %m");
+ fprintf (stderr, "strdup: %s", strerror(errno));
return (-1);
}
strlcat(volinfofile, ".AppleDesktop/", sizeof(volinfofile));
/* open the file read only */
if ( NULL == (fp = fopen( volinfofile, "r")) ) {
- fprintf (stderr, "error opening volinfo (%s): %m", volinfofile);
+ fprintf (stderr, "error opening volinfo (%s): %s", volinfofile, strerror(errno));
return (-1);
}
fd = fileno(fp);