Add additional #include directives for more function prototypes,
to avoid implicit function declarations. Declare appledouble_write,
cmdline_afp_setup_client in the appropriate header files.
These changes expose an argument type mismatch in the function
appledouble_truncate, in the calls to remove_opened_fork. This may
or may have not worked before, depending on how the ABI implements
passing this struct by value.
The use of basename in start_afpfsd is suspect; this should probaby use
dirname instead.
Submitted upstream: <https://sourceforge.net/p/afpfs-ng/patches/5/>
diff --git a/cmdline/cmdline_afp.h b/cmdline/cmdline_afp.h
index ebdf357fc952972c..e0ec4570f69b71ec 100644
--- a/cmdline/cmdline_afp.h
+++ b/cmdline/cmdline_afp.h
@@ -28,5 +28,6 @@ int com_disconnect(char * arg);
void cmdline_afp_exit(void);
int cmdline_afp_setup(int recursive, char * url_string);
+void cmdline_afp_setup_client(void);
#endif
diff --git a/cmdline/cmdline_main.c b/cmdline/cmdline_main.c
index ffb39ebacb8f262c..deccf8a4cc342bf0 100644
--- a/cmdline/cmdline_main.c
+++ b/cmdline/cmdline_main.c
@@ -17,6 +17,7 @@
#include <getopt.h>
#include <ctype.h>
#include <signal.h>
+#include "afp.h"
#include "cmdline_afp.h"
#include "cmdline_testafp.h"
diff --git a/fuse/client.c b/fuse/client.c
index d19e9efb2dcb60b7..beceaa5594a89b80 100644
--- a/fuse/client.c
+++ b/fuse/client.c
@@ -10,6 +10,7 @@
#include <unistd.h>
#include <errno.h>
#include <grp.h>
+#include <libgen.h>
#include "config.h"
#include <afp.h>
diff --git a/fuse/daemon.c b/fuse/daemon.c
index 8b3b8d9146633518..abf6c02e390142b2 100644
--- a/fuse/daemon.c
+++ b/fuse/daemon.c
@@ -23,6 +23,8 @@
#include <signal.h>
#include <sys/socket.h>
+#include <fuse.h>
+
#include "afp.h"
#include "dsi.h"
diff --git a/lib/dsi.c b/lib/dsi.c
index 8a469794542ec447..3fd10fb24c770ca8 100644
--- a/lib/dsi.c
+++ b/lib/dsi.c
@@ -27,6 +27,7 @@
#include "libafpclient.h"
#include "afp_internal.h"
#include "afp_replies.h"
+#include "codepage.h"
/* define this in order to get reams of DSI debugging information */
#undef DEBUG_DSI
diff --git a/lib/lowlevel.c b/lib/lowlevel.c
index f3b632c2ae2da763..1edc9cdce5cc8429 100644
--- a/lib/lowlevel.c
+++ b/lib/lowlevel.c
@@ -25,6 +25,8 @@
#include "utils.h"
#include "did.h"
#include "users.h"
+#include "midlevel.h"
+#include "forklist.h"
static void set_nonunix_perms(unsigned int * mode, struct afp_file_info *fp)
{
diff --git a/lib/proto_files.c b/lib/proto_files.c
index 933956da6a6d2ce6..d2acd562a2671869 100644
--- a/lib/proto_files.c
+++ b/lib/proto_files.c
@@ -14,6 +14,7 @@
#include "dsi_protocol.h"
#include "afp_protocol.h"
#include "afp_internal.h"
+#include "afp_replies.h"
/* afp_setfileparms, afp_setdirparms and afpsetfiledirparms are all remarkably
similiar. We abstract them to afp-setparms_lowlevel. */
diff --git a/lib/proto_replyblock.c b/lib/proto_replyblock.c
index f66791614a52ca3d..c59629b24ab83cec 100644
--- a/lib/proto_replyblock.c
+++ b/lib/proto_replyblock.c
@@ -10,6 +10,7 @@
#include "afp.h"
#include "utils.h"
#include "afp_internal.h"
+#include "afp_replies.h"
/* FIXME: should do bounds checking */
diff --git a/lib/resource.c b/lib/resource.c
index 6be4a5b1de51fec5..fb39889f0d7702c0 100644
--- a/lib/resource.c
+++ b/lib/resource.c
@@ -8,6 +8,7 @@
#include "lowlevel.h"
#include "did.h"
#include "midlevel.h"
+#include "forklist.h"
#define appledouble ".AppleDouble"
#define finderinfo_string ".finderinfo"
@@ -362,12 +363,12 @@ int appledouble_truncate(struct afp_volume * volume, const char * path, int offs
ret=ll_zero_file(volume,fp.forkid,0);
if (ret<0) {
afp_closefork(volume,fp.forkid);
- remove_opened_fork(volume,fp);
+ remove_opened_fork(volume,&fp);
free(newpath);
return ret;
}
afp_closefork(volume,fp.forkid);
- remove_opened_fork(volume,fp);
+ remove_opened_fork(volume,&fp);
return 1;
case AFP_META_APPLEDOUBLE:
diff --git a/lib/resource.h b/lib/resource.h
index 6a0d38a6275dd6f5..2efff106c94e6637 100644
--- a/lib/resource.h
+++ b/lib/resource.h
@@ -31,6 +31,9 @@ int appledouble_read(struct afp_volume * volume, struct afp_file_info *fp,
int appledouble_close(struct afp_volume * volume, struct afp_file_info * fp);
+int appledouble_write(struct afp_volume * volume, struct afp_file_info *fp,
+ const char *data, size_t size, off_t offset, size_t *totalwritten);
+
int appledouble_chmod(struct afp_volume * volume, const char * path, mode_t mode);
int appledouble_unlink(struct afp_volume * volume, const char *path);
diff --git a/lib/server.c b/lib/server.c
index 977c418efccae88b..93400dd92a4c0af6 100644
--- a/lib/server.c
+++ b/lib/server.c
@@ -7,6 +7,7 @@
#include <string.h>
#include <time.h>
+#include <sys/time.h>
#include "afp.h"
#include "dsi.h"