if(chdir(mountpoint)) {
printf("mount error: can not change directory into mount target %s\n",mountpoint);
+ return -1;
}
- if(stat (mountpoint, &statbuf)) {
+ if(stat (".", &statbuf)) {
printf("mount error: mount point %s does not exist\n",mountpoint);
return -1;
}
optlen += strlen(mountpassword) + 6;
options = malloc(optlen + 10);
+ if(options == NULL) {
+ printf("Could not allocate memory for mount options\n");
+ return -1;
+ }
+
+
options[0] = 0;
strncat(options,"unc=",4);
strcat(options,share_name);