/* Includes LFS defines, which defines behaviours of some of the following
* headers, so must come before those */
#include "config.h"
+#include "lfs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <strings.h>
#include <dirent.h>
+#include <glib.h>
+
/* used in cliserv.h, so must come first */
#define MY_NAME "nbd_server"
#include "cliserv.h"
**/
int splitexport(void) {
off_t i ;
-
+
for (i=0; i<exportsize; i+=hunksize) {
char exportname3[1024];
-
- snprintf(exportname3, 1024, "%s.%d", exportname2, (int)(i/hunksize));
+
+ if(flags & F_MULTIFILE) {
+ snprintf(exportname3, 1024, "%s.%d", exportname2, (int)(i/hunksize));
+ } else {
+ strncpy(exportname3, exportname2, 1024);
+ }
exportname3[1023]='\0';
printf( "Opening %s\n", exportname3 );
if ((export[i/hunksize] = open(exportname3, (flags & F_READONLY) ? O_RDONLY : O_RDWR)) == -1) {