diff --git a/smb.c b/smb.c index 7ce8f11..8b6c806 100644 --- a/smb.c +++ b/smb.c @@ -927,14 +927,21 @@ static int open_and_read(Word ipid, const uint16_t *path) responsePtr = *(smb_response **)h; status = responsePtr->header.status; - if (status == STATUS_OBJECT_NAME_NOT_FOUND) + + switch(status) { + case STATUS_OBJECT_NAME_NOT_FOUND: + case STATUS_NO_SUCH_FILE: fprintf(stderr, "File not found\n"); return -1; - } - if (status) - { + + case STATUS_FILE_IS_A_DIRECTORY: + fprintf(stderr, "File is a directory\n"); + return -1; + + default: fprintf(stderr, "Open error: %08lx\n", status); + return -1; } file_id[0] = responsePtr->body.create.file_id[0]; diff --git a/smb.errors.h b/smb.errors.h index 034de99..5198b57 100644 --- a/smb.errors.h +++ b/smb.errors.h @@ -21,6 +21,7 @@ #define STATUS_OBJECT_NAME_INVALID 0xC0000033 #define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034 #define STATUS_OBJECT_NAME_COLLISION 0xC0000035 +#define STATUS_FILE_IS_A_DIRECTORY 0xC00000BA #define STATUS_FILE_CLOSED 0xC0000128 #define STATUS_NO_USER_SESSION_KEY 0xC0000202 #define STATUS_USER_SESSION_DELETED 0xC0000203