Bug 9516 - Wrong return code when failing to remove a directory
Summary: Wrong return code when failing to remove a directory
Status: NEW
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2012-12-20 14:28 UTC by Nicolas Delvaux
Modified: 2012-12-20 14:28 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Delvaux 2012-12-20 14:28:41 UTC
(I also have this problem with Samba 3)

~$ smbclient -U user%pass \\\\server\\outbox -c "rmdir [PROTECTED-FOLDER]"

> ...
> NT_STATUS_UNSUCCESSFUL removing remote directory file \[PROTECTED-FOLDER]

~$ echo $?
> 0

As this is an error, smbclient should return 1.
Please note that smbclient already returns 1, for example when it fails to rename the very same folder.

If you want a proper patch, I can provide it.
Otherwise, you just need to add a "return 1;" after this line:

You may also want to check all return codes in the same file. For example, there is apparently the same problem when trying to delete files:

This fix may not be just cosmetic. For example, return codes are useful when writing tests.