// We have a context but last Xform iteration fail or application set a message
if (request->jresp != NULL) {
jresp = request->jresp; // retrieve previous error from postCtx
- } else jresp = jsonNewMessage(AFB_FAIL,"getPostFile Post Request done");
+ } else jresp = jsonNewMessage(AFB_SUCCESS,"getPostFile Post Request done");
// Error or not let's free all resources
close(postFileCtx->fd);
// make sure destination directory exist
destDir = opendir (filepath);
if (destDir == NULL) {
- if ( 0 <= mkdir(filepath,O_RDWR | S_IRWXU | S_IRGRP)) {
+ if (mkdir(filepath,O_RDWR | S_IRWXU | S_IRGRP) < 0) {
postFileCtx->jresp= jsonNewMessage(AFB_FAIL,"Fail to Create destination directory=[%s] error=%s\n", filepath, strerror(errno));
goto ExitOnError;
}
postFileCtx->path = strdup (filepath);
if (verbose) fprintf(stderr, "getPostFile path=%s\n", filepath);
-
+
if((postFileCtx->fd = open(filepath, O_RDWR |O_CREAT, S_IRWXU|S_IRGRP)) <= 0) {
postFileCtx->jresp= jsonNewMessage(AFB_FAIL,"Fail to Create destination File=[%s] error=%s\n", filepath, strerror(errno));
goto ExitOnError;