mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
unit_tests: call umask before mkstemp
Coverity 188788
This commit is contained in:
parent
1afc1d0d26
commit
45a6880d78
@ -26,6 +26,10 @@
|
|||||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
@ -37,8 +41,14 @@
|
|||||||
|
|
||||||
TEST(notify, works)
|
TEST(notify, works)
|
||||||
{
|
{
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
mode_t prevmode = umask(077);
|
||||||
|
#endif
|
||||||
char name_template[] = "/tmp/monero-notify-unit-test-XXXXXX";
|
char name_template[] = "/tmp/monero-notify-unit-test-XXXXXX";
|
||||||
int fd = mkstemp(name_template);
|
int fd = mkstemp(name_template);
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
umask(prevmode);
|
||||||
|
#endif
|
||||||
ASSERT_TRUE(fd >= 0);
|
ASSERT_TRUE(fd >= 0);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user