IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8385


Ignore:
Timestamp:
Aug 16, 2006, 9:14:42 AM (20 years ago)
Author:
eugene
Message:

added check_dir_access, removed unused variables

Location:
trunk/Ohana/src/libohana
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libohana/include/ohana.h

    r8303 r8385  
    125125void    make_backup            PROTO((char *filename));
    126126int     check_file_access      PROTO((char *basefile, int backup, int verbose));
     127int     check_dir_access       PROTO((char *path, int verbose));
    127128int     check_file_exec        PROTO((char *filename));
    128129
  • trunk/Ohana/src/libohana/src/CommOps.c

    r7939 r8385  
    7474int SendMessage (int device, char *format, ...) {
    7575
    76   int Nbyte, status;
     76  int Nbyte;
    7777  char tmp;
    7878  va_list argp; 
  • trunk/Ohana/src/libohana/src/IOBufferOps.c

    r7929 r8385  
    102102  /* add the output line to the given IOBuffer */
    103103 
    104   int Nbyte, status;
    105   char tmp, *line;
     104  int Nbyte;
     105  char tmp;
    106106
    107107  Nbyte = vsnprintf (&tmp, 0, format, argp);
  • trunk/Ohana/src/libohana/src/findexec.c

    r6674 r8385  
    2525}
    2626
    27 /* check that file can be written to:
     27/* check that:
    2828   - dir exists
    2929   - dir permissions OK
    30    - file permissions OK,
    31    - file backup permission OK (optional)
    32 */
    33 int check_file_access (char *basefile, int BACKUP, int VERBOSE) {
    34  
    35   char *path, *filename;
     30*/
     31int check_dir_access (char *path, int VERBOSE) {
     32 
    3633  struct stat filestat;
    3734  uid_t uid;
     
    4340
    4441  /* check permission to write to directory */
    45   path = pathname (basefile);
    4642  status = stat (path, &filestat);
    4743  if (status == -1) {
     
    6258    return (FALSE);
    6359  }
     60  return (TRUE);
     61}
     62
     63/* check that file can be written to:
     64   - dir exists
     65   - dir permissions OK
     66   - file permissions OK,
     67   - file backup permission OK (optional)
     68*/
     69int check_file_access (char *basefile, int BACKUP, int VERBOSE) {
     70 
     71  char *path, *filename;
     72  struct stat filestat;
     73  uid_t uid;
     74  gid_t gid;
     75  int status;
     76
     77  uid = getuid();
     78  gid = getgid();
     79
     80  /* check permission to write to directory */
     81  path = pathname (basefile);
     82  status = check_dir_access (path, VERBOSE);
    6483  free (path);
     84  if (!status) return (FALSE);
    6585 
    6686  /* check permission to write to file */
  • trunk/Ohana/src/libohana/src/time.c

    r7964 r8385  
    410410double ohana_lst (double jd, double longitude) {
    411411
    412   double t, ut, jdmid, jdint, jdfrac, sid_g, sid;
     412  double t, ut, jdmid, jdint, jdfrac, sid_g;
    413413  long sid_int;
    414414
Note: See TracChangeset for help on using the changeset viewer.