gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master a8422ee: Write access only when necessary in F


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master a8422ee: Write access only when necessary in Fits program
Date: Thu, 24 Aug 2017 13:45:08 -0400 (EDT)

branch: master
commit a8422ee3a0085dc6f6e1fd40d5dd8ae38499b921
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Write access only when necessary in Fits program
    
    Until now, when the Fits program was asked to copy an extension to another
    or cut it, it would open the FITS file in `READWRITE' mode. This wouldn't
    work when the input was a `fits.gz' file. So now, only when the user asks
    to cut an extension, does `fits_hdu_copy' ask for write access. When the
    user just wants to copy a HDU to another file, it will ask for `READONLY'
    permissions.
---
 bin/fits/fits.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/fits/fits.c b/bin/fits/fits.c
index 3af2ce5..60db9f6 100644
--- a/bin/fits/fits.c
+++ b/bin/fits/fits.c
@@ -286,7 +286,8 @@ fits_hdu_copy(struct fitsparams *p, int cut1_copy0, int *r)
       hdu=gal_list_str_pop(&list);
 
       /* Open the FITS file at the specified HDU. */
-      in=gal_fits_hdu_open(p->filename, hdu, READWRITE);
+      in=gal_fits_hdu_open(p->filename, hdu,
+                           cut1_copy0 ? READWRITE : READONLY);
 
       /* Copy to the extension. */
       if( fits_copy_hdu(in, out, 0, &status) )



reply via email to

[Prev in Thread] Current Thread [Next in Thread]