[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r36875 - gnunet/src/social
From: |
gnunet |
Subject: |
[GNUnet-SVN] r36875 - gnunet/src/social |
Date: |
Wed, 27 Jan 2016 21:45:36 +0100 |
Author: tg
Date: 2016-01-27 21:45:36 +0100 (Wed, 27 Jan 2016)
New Revision: 36875
Modified:
gnunet/src/social/gnunet-service-social.c
gnunet/src/social/test_social.c
Log:
social: save file
Modified: gnunet/src/social/gnunet-service-social.c
===================================================================
--- gnunet/src/social/gnunet-service-social.c 2016-01-26 21:22:29 UTC (rev
36874)
+++ gnunet/src/social/gnunet-service-social.c 2016-01-27 20:45:36 UTC (rev
36875)
@@ -914,7 +914,16 @@
/* save if does not already exist */
if (GNUNET_YES != GNUNET_DISK_file_test (filename))
{
- plc->file_save = GNUNET_YES;
+ if (0 == GNUNET_DISK_fn_write (filename, NULL, 0,
+ GNUNET_DISK_PERM_USER_READ
+ | GNUNET_DISK_PERM_USER_WRITE))
+ {
+ plc->file_save = GNUNET_YES;
+ }
+ else
+ {
+ GNUNET_break (0);
+ }
}
GNUNET_free (filename);
}
@@ -945,13 +954,20 @@
GNUNET_DISK_directory_create_for_file (filename);
struct GNUNET_DISK_FileHandle *
fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE,
- GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
+ GNUNET_DISK_PERM_NONE);
GNUNET_free (filename);
- GNUNET_DISK_file_seek (fh, plc->file_offset, GNUNET_DISK_SEEK_SET);
- GNUNET_DISK_file_write (fh, data, data_size);
- GNUNET_DISK_file_close (fh);
+ if (NULL != fh)
+ {
+ GNUNET_DISK_file_seek (fh, plc->file_offset, GNUNET_DISK_SEEK_SET);
+ GNUNET_DISK_file_write (fh, data, data_size);
+ GNUNET_DISK_file_close (fh);
+ }
+ else
+ {
+ GNUNET_break (0);
+ }
+
plc->file_offset += data_size;
}
Modified: gnunet/src/social/test_social.c
===================================================================
--- gnunet/src/social/test_social.c 2016-01-26 21:22:29 UTC (rev 36874)
+++ gnunet/src/social/test_social.c 2016-01-27 20:45:36 UTC (rev 36875)
@@ -300,7 +300,7 @@
return GNUNET_YES;
}
- uint16_t size = strlen (tmit->data[tmit->n]) + 1;
+ uint16_t size = strlen (tmit->data[tmit->n]);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmit notify data: %u bytes available, "
"processing fragment %u/%u (size %u).\n",
@@ -932,10 +932,10 @@
"_bar_foo", DATA2ARG ("one two three"));
GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
"_bar_baz", DATA2ARG ("four five"));
- tmit.data[0] = "zzz xxx yyy";
- tmit.data[1] = "zyx wvu tsr qpo";
+ tmit.data[0] = "zzz xxx yyy ";
+ tmit.data[1] = "zyx wvu tsr qpo.\n";
tmit.data_delay[1] = 1;
- tmit.data[2] = "testing ten nine eight";
+ tmit.data[2] = "testing ten nine eight.\n";
tmit.data_count = 3;
tmit.guest_talk
@@ -961,11 +961,11 @@
"_foo_bar", DATA2ARG ("foo bar"));
GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
"_foo_bar_baz", DATA2ARG ("foo bar baz"));
- tmit.data[0] = "aaa bbb ccc";
- tmit.data[1] = "abc def ghi jkl";
+ tmit.data[0] = "aaa bbb ccc ";
+ tmit.data[1] = "abc def ghi jkl.\n";
tmit.data_delay[1] = 1;
- tmit.data[2] = "testing one two three";
- tmit.data[3] = "four five";
+ tmit.data[2] = "testing one two three ";
+ tmit.data[3] = "four five.\n";
tmit.data_count = 4;
tmit.host_ann
@@ -995,9 +995,9 @@
"_foo2_bar", DATA2ARG ("FOO BAR"));
GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
"_foo2_bar", DATA2ARG ("FOO BAR BAZ"));
- tmit.data[0] = "AAA BBB CCC";
- tmit.data[1] = "ABC DEF GHI JKL";
- tmit.data[2] = "TESTING ONE TWO THREE";
+ tmit.data[0] = "AAA BBB CCC ";
+ tmit.data[1] = "ABC DEF GHI JKL.\n";
+ tmit.data[2] = "TESTING ONE TWO THREE.\n";
tmit.data_count = 3;
tmit.host_ann
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r36875 - gnunet/src/social,
gnunet <=