summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2001-03-05 13:34:48 +0000
committerRichard Sharpe <sharpe@samba.org>2001-03-05 13:34:48 +0000
commit134c0d27cce4a6912212770f645a46a22e204ad6 (patch)
tree32e051a604777dac4ad7f3ea278931dc8e31c6f2
parente2e56e84f07c9427990a2269c5970c1acb4c3967 (diff)
downloadsamba-134c0d27cce4a6912212770f645a46a22e204ad6.tar.gz
samba-134c0d27cce4a6912212770f645a46a22e204ad6.tar.bz2
samba-134c0d27cce4a6912212770f645a46a22e204ad6.zip
smb.h: add one error code for no such printer job
libsmbclient.c: fix problems with return codes on smbc_unlink_print_job (This used to be commit 7557f9145ccdced3fcebdd20e1eb6fc5a27abda2)
-rw-r--r--source3/include/smb.h1
-rw-r--r--source3/libsmb/libsmbclient.c31
2 files changed, 29 insertions, 3 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 15fb7beada..d4073a2314 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -174,6 +174,7 @@ implemented */
#define ERRbaddirectory 267 /* Invalid directory name in a path. */
#define ERRunknownipc 2142
#define ERRbuftoosmall 2123
+#define ERRnosuchprintjob 2151
#define ERROR_SUCCESS (0)
#define ERROR_INVALID_FUNCTION (1)
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 29f2d807ba..410e2ebdd6 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -851,8 +851,9 @@ int smbc_unlink(const char *fname)
return -1;
}
- if (cli_printjob_del(&srv->cli, job) != 0) {
+ if ((err = cli_printjob_del(&srv->cli, job)) != 0) {
+
return -1;
}
@@ -2102,6 +2103,7 @@ off_t smbc_telldir(int fd)
int smbc_lseekdir(int fd, off_t offset, int whence)
{
+ struct smbc_file *fe;
if (!smbc_initialized) {
@@ -2117,6 +2119,24 @@ int smbc_lseekdir(int fd, off_t offset, int whence)
}
+ fe = smbc_file_table[fd - smbc_start_fd];
+
+ if (!fe) {
+
+ errno = EBADF;
+ return -1;
+
+ }
+
+ if (fe->file != False) { /* FIXME, should be dir, perhaps */
+
+ errno = ENOTDIR;
+ return -1;
+
+ }
+
+ /* Now, check what we were passed and see if it is OK ... */
+
return ENOSYS; /* Not implemented so far ... */
}
@@ -2309,6 +2329,7 @@ int smbc_unlink_print_job(const char *fname, int id)
struct smbc_server *srv;
fstring server, share, user, password;
pstring path;
+ int err;
if (!smbc_initialized) {
@@ -2338,11 +2359,15 @@ int smbc_unlink_print_job(const char *fname, int id)
}
- if (cli_printjob_del(&srv->cli, id) < 0) {
+ if ((err = cli_printjob_del(&srv->cli, id)) != 0) {
- errno = smbc_errno(&srv->cli);
+ if (err < 0)
+ errno = smbc_errno(&srv->cli);
+ else if (err == ERRnosuchprintjob)
+ errno = EINVAL;
return -1;
+
}
return 0;