LCOV - code coverage report
Current view: top level - src - file_access_status.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 83.3 % 6 5
Test Date: 2026-07-12 01:01:34 Functions: 100.0 % 1 1
Branches: 50.0 % 8 4

             Branch data     Line data    Source code
       1                 :             : #include "precizer.h"
       2                 :             : #include <errno.h>
       3                 :             : 
       4                 :             : /**
       5                 :             :  * @brief Classify a filesystem access errno value into FileAccessStatus
       6                 :             :  *
       7                 :             :  * Maps common filesystem errors to a stable, high-level status:
       8                 :             :  * - ENOENT, ENOTDIR -> FILE_NOT_FOUND
       9                 :             :  * - EACCES, EPERM   -> FILE_ACCESS_DENIED
      10                 :             :  * - otherwise       -> FILE_ACCESS_ERROR
      11                 :             :  *
      12                 :             :  * @param err errno value from a failed filesystem path operation
      13                 :             :  * @return FileAccessStatus classification
      14                 :             :  */
      15                 :          62 : FileAccessStatus file_access_status(const int err)
      16                 :             : {
      17   [ +  +  -  + ]:          62 :         if(err == ENOENT || err == ENOTDIR)
      18                 :             :         {
      19                 :          41 :                 return(FILE_NOT_FOUND);
      20                 :             :         }
      21                 :             : 
      22   [ -  +  -  - ]:          21 :         if(err == EACCES || err == EPERM)
      23                 :             :         {
      24                 :          21 :                 return(FILE_ACCESS_DENIED);
      25                 :             :         }
      26                 :             : 
      27                 :           0 :         return(FILE_ACCESS_ERROR);
      28                 :             : }
        

Generated by: LCOV version 2.0-1