Commit b5bedd744d0353819815b34b388e41ca71c4e870

Authored by Jürgen Knödlseder
1 parent 1a1719b0

Replace std::tmpnam() by gammalib::tmpnam() function in ctselect (#3324)

ChangeLog
1 -2020-11-07 1 +2020-11-17
2 2
3 * Version 2.0.0 released 3 * Version 2.0.0 released
4 ======================== 4 ========================
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 Add models() method to ctobssim (#3441) 6 Add models() method to ctobssim (#3441)
7 Add ctlike results to XML file (#3431) 7 Add ctlike results to XML file (#3431)
8 Fix implementation of fix_spat_for_ts parameter in ctlike (#3426) 8 Fix implementation of fix_spat_for_ts parameter in ctlike (#3426)
  9 + Replace std::tmpnam() by gammalib::tmpnam() function in ctselect (#3324)
9 10
10 11
11 2020-09-04 12 2020-09-04
1 New Features and Important Changes in ctools 2.0.0 1 New Features and Important Changes in ctools 2.0.0
2 2
3 -7 November 2020 3 +17 November 2020
4 4
5 5
6 Introduction 6 Introduction
@@ -118,7 +118,7 @@ None @@ -118,7 +118,7 @@ None
118 118
119 ctselect - CTA event selection 119 ctselect - CTA event selection
120 ------------------------------ 120 ------------------------------
121 -None 121 +Replaced std::tmpnam() by gammalib::tmpnam() function in ctselect (#3324).
122 122
123 123
124 ctskymap - CTA sky mapping 124 ctskymap - CTA sky mapping
README.md
1 ctools information 1 ctools information
2 ================== 2 ==================
3 -* Version: 2.0.0.dev (7 November 2020) 3 +* Version: 2.0.0.dev (17 November 2020)
4 * GammaLib dependency: 2.0.0.dev 4 * GammaLib dependency: 2.0.0.dev
5 5
6 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/) 6 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/)
configure.ac
@@ -31,9 +31,8 @@ @@ -31,9 +31,8 @@
31 AC_INIT([ctools], [2.0.0.dev], [jurgen.knodlseder@irap.omp.eu], [ctools]) 31 AC_INIT([ctools], [2.0.0.dev], [jurgen.knodlseder@irap.omp.eu], [ctools])
32 AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp]) 32 AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp])
33 AC_CONFIG_MACRO_DIR([m4]) 33 AC_CONFIG_MACRO_DIR([m4])
34 -#AM_INIT_AUTOMAKE([gnu no-dependencies foreign])  
35 -AM_INIT_AUTOMAKE([gnu -Wno-portability foreign])  
36 -#AM_INIT_AUTOMAKE([gnu -Wno-portability foreign serial-tests]) 34 +#AM_INIT_AUTOMAKE([gnu -Wno-portability foreign])
  35 +AM_INIT_AUTOMAKE([gnu -Wno-portability foreign serial-tests])
37 AC_CONFIG_HEADER([config.h]) 36 AC_CONFIG_HEADER([config.h])
38 37
39 38
doc/source/admin/release_history/2.0.rst
1 .. _2.0: 1 .. _2.0:
2 2
3 -ctools 2.0 release (7 November 2020)  
4 -==================================== 3 +ctools 2.0 release (17 November 2020)
  4 +=====================================
5 5
6 Overview 6 Overview
7 -------- 7 --------
@@ -28,6 +28,8 @@ Improvements @@ -28,6 +28,8 @@ Improvements
28 Add ``models()`` method to :ref:`ctobssim` 28 Add ``models()`` method to :ref:`ctobssim`
29 * [`3431 <https://cta-redmine.irap.omp.eu/issues/3431>`_] - 29 * [`3431 <https://cta-redmine.irap.omp.eu/issues/3431>`_] -
30 Add :ref:`ctlike` results to XML file 30 Add :ref:`ctlike` results to XML file
  31 +* [`3324 <https://cta-redmine.irap.omp.eu/issues/3324>`_] -
  32 + Replace ``std::tmpnam()`` by ``gammalib::tmpnam()`` function in :ref:`ctselect`
31 33
32 34
33 New features 35 New features
src/ctselect/ctselect.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctselect - Data selection tool * 2 * ctselect - Data selection tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2018 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2020 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -42,7 +42,6 @@ @@ -42,7 +42,6 @@
42 /* __ Debug definitions __________________________________________________ */ 42 /* __ Debug definitions __________________________________________________ */
43 43
44 /* __ Coding definitions _________________________________________________ */ 44 /* __ Coding definitions _________________________________________________ */
45 -//#define G_USE_MKSTEMP //!< Use mkstemp for temporary filename  
46 45
47 46
48 /*========================================================================== 47 /*==========================================================================
@@ -297,13 +296,7 @@ void ctselect::run(void) @@ -297,13 +296,7 @@ void ctselect::run(void)
297 } 296 }
298 297
299 // Get temporary file name 298 // Get temporary file name
300 - #if G_USE_MKSTEMP  
301 - char tpl[] = "ctselectXXXXXX";  
302 - int fileid = mkstemp(tpl);  
303 - std::string filename(tpl);  
304 - #else  
305 - std::string filename = std::tmpnam(NULL);  
306 - #endif 299 + std::string filename = gammalib::tmpnam();
307 300
308 // Save observation in temporary file. We add here the events and 301 // Save observation in temporary file. We add here the events and
309 // GTI extension name so that the GCTAObservation::save method can 302 // GTI extension name so that the GCTAObservation::save method can
@@ -330,11 +323,6 @@ void ctselect::run(void) @@ -330,11 +323,6 @@ void ctselect::run(void)
330 // Load observation from temporary file, including event selection 323 // Load observation from temporary file, including event selection
331 select_events(obs, filename, m_evtname[i], m_gtiname[i]); 324 select_events(obs, filename, m_evtname[i], m_gtiname[i]);
332 325
333 - // Close temporary file  
334 - #if G_USE_MKSTEMP  
335 - close(fileid);  
336 - #endif  
337 -  
338 // Remove temporary file 326 // Remove temporary file
339 std::remove(filename.c_str()); 327 std::remove(filename.c_str());
340 328