This patch fixes the leaks reported by valgrind in the library.

The valgrind output after this patch is applied is,

[r...@gondor tests]# sh runlibcgrouptest.sh 

Running first set of testcases
==============================
==14406== Memcheck, a memory error detector.
==14406== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14406== Using LibVEX rev 1804, a library for dynamic binary translation.
==14406== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.       
==14406== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14406== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.  
==14406== For more details, rerun with: -v                                 
==14406==                                                                  
C:DBG: fs_mounted as recieved from script=0                                
TEST 1:PASS : cgroup_init()                      Ret Value = 50001         
TEST 2:PASS : cgroup_attach_task()               Ret Value = 50014       
Parameter nullcgroup
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0                  
             
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 50014              
             
TEST 5:PASS : cgroup_delete_cgroup()             Ret Value = 50014              
             
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 50014              
             
TEST 7:PASS : cgroup_delete_cgroup()             Ret Value = 50014              
             
TEST 8:PASS : cgroup_add_controller()            Ret Value = 0                  
             
TEST 9:PASS : cgroup_add_controller()            Ret Value = 0                  
             
TEST10:PASS : cgroup_add_controller()            Ret Value = 0                  
             
==14406==                                                                       
             
==14406== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 1)       
             
==14406== malloc/free: in use at exit: 704 bytes in 2 blocks.                   
             
==14406== malloc/free: 18 allocs, 16 frees, 32,293 bytes allocated.             
             
==14406== For counts of detected errors, rerun with: -v                         
             
==14406== searching for pointers to 2 not-freed blocks.                         
             
==14406== checked 6,389,612 bytes.                                              
             
==14406==                                                                       
             
==14406== 704 bytes in 2 blocks are still reachable in loss record 1 of 1       
             
==14406==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)                     
             
==14406==    by 0x4C2AC78E: __fopen_internal (in /lib/libc-2.9.so)              
             
==14406==    by 0x4C2AC85B: fopen@@GLIBC_2.1 (in /lib/libc-2.9.so)              
             
==14406==    by 0x8049155: get_controllers(char const*, int*) 
(libcgrouptest01.c:979)        
==14406==    by 0x804B589: main (libcgrouptest01.c:84)                          
             
==14406==                                                                       
             
==14406== LEAK SUMMARY:                                                         
             
==14406==    definitely lost: 0 bytes in 0 blocks.                              
             
==14406==      possibly lost: 0 bytes in 0 blocks.                              
             
==14406==    still reachable: 704 bytes in 2 blocks.                            
             
==14406==         suppressed: 0 bytes in 0 blocks.                              
             

Running second set of testcases
============================== 
==14422== Memcheck, a memory error detector.
==14422== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14422== Using LibVEX rev 1804, a library for dynamic binary translation.
==14422== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.       
==14422== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14422== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.  
==14422== For more details, rerun with: -v                                 
==14422==                                                                  
C:DBG: fs_mounted as recieved from script=1                                
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1       
sanity check pass. cgroup                                                  
TEST 1:PASS : cgroup_attach_task()               Ret Value = 50014       
Parameter nullcgroup
TEST 2:PASS : cgroup_init()                      Ret Value = 0                  
             
TEST 3:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s       
TEST 4:PASS : cgroup_attach_task_pid()           Ret Value = 50016              
             
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0                  
             
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem   
TEST 7:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s       
==14422== Conditional jump or move depends on uninitialised value(s)            
             
==14422==    at 0x40070D8: strncat (mc_replace_strmem.c:214)                    
             
==14422==    by 0x804BAAA: main (libcgrouptest01.c:1255)                        
             
==14422==                                                                       
             
==14422== Conditional jump or move depends on uninitialised value(s)            
             
==14422==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
             
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
             
==14422==    by 0x804BAB5: main (libcgrouptest01.c:251)                         
             
==14422==                                                                       
             
==14422== Conditional jump or move depends on uninitialised value(s)            
             
==14422==    at 0x4007285: strcpy (mc_replace_strmem.c:268)                     
             
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
             
==14422==    by 0x804BAB5: main (libcgrouptest01.c:251)                         
             
==14422==                                                                       
             
==14422== Conditional jump or move depends on uninitialised value(s)            
             
==14422==    at 0x8049381: _ZL14group_modifiedPci (libcgrouptest01.c:1072)      
             
==14422==    by 0x804C367: main (libcgrouptest01.c:253)                         
             
==14422==                                                                       
             
==14422== Conditional jump or move depends on uninitialised value(s)            
             
==14422==    at 0x8049389: _ZL14group_modifiedPci (libcgrouptest01.c:1072)      
             
==14422==    by 0x804C367: main (libcgrouptest01.c:253)                         
             
==14422==                                                                       
             
==14422== Conditional jump or move depends on uninitialised value(s)            
             
==14422==    at 0x4007470: strncmp (mc_replace_strmem.c:314)                    
             
==14422==    by 0x80493A9: _ZL14group_modifiedPci (libcgrouptest01.c:1072)      
             
==14422==    by 0x804C367: main (libcgrouptest01.c:253)                         
             
TEST 8:PASS : cgroup_modify_cgroup()             Ret Value = 0   Parameter same 
cgroup       
TEST 9:PASS : cgroup_new_cgroup()                Ret Value = 0                  
             
==14422==                                                                       
             
==14422== Conditional jump or move depends on uninitialised value(s)            
             
==14422==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
             
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
             
==14422==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14422==    by 0x804BB41: main (libcgrouptest01.c:285)                         
                                                
==14422==                                                                       
                                                
==14422== Conditional jump or move depends on uninitialised value(s)            
                                                
==14422==    at 0x4007285: strcpy (mc_replace_strmem.c:268)                     
                                                
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
                                                
==14422==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14422==    by 0x804BB41: main (libcgrouptest01.c:285)                         
                                                
TEST10:PASS : cgroup_modify_cgroup()             Ret Value = 0                  
                                                
TEST11:PASS : cgroup_modify_cgroup()             Ret Value = 50007              
                                                
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0                  
                                                
==14422==                                                                       
                                                
==14422== Conditional jump or move depends on uninitialised value(s)            
                                                
==14422==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
                                                
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
                                                
==14422==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14422==    by 0x804BBF3: main (libcgrouptest01.c:313)                         
                                                
==14422==                                                                       
                                                
==14422== Conditional jump or move depends on uninitialised value(s)            
                                                
==14422==    at 0x4007285: strcpy (mc_replace_strmem.c:268)                     
                                                
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
                                                
==14422==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14422==    by 0x804BBF3: main (libcgrouptest01.c:313)                         
                                                
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0                  
                                                
TEST14:PASS : cgroup_get_cgroup()                Ret Value = 50007       
Parameter nullcgroup                                   
TEST15:PASS : cgroup_get_cgroup()                Ret Value = 50002       
Parameter not created group                            
TEST16:PASS : cgroup_get_cgroup()                Ret Value = 0                  
                                                
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0                  
                                                
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem                                      
TEST17:FAIL : cgroup_get_cgroup()                Ret Value = 50017              
                                                
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted 
from filesystem                                  
TEST17:PASS : cgroup_create_cgroup()             Ret Value = 50007              
                                                
TEST18:PASS : cgroup_delete_cgroup()             Ret Value = 50007              
                                                
TEST19:PASS : cgroup_compare_cgroup()            Ret Value = 50011       
Parameter nullcgroup                                   
TEST20:PASS : cgroup_compare_cgroup()            Ret Value = 0                  
                                                
TEST21:PASS : cgroup_compare_cgroup()            Ret Value = 50017              
                                                
==14422==                                                                       
                                                
==14422== ERROR SUMMARY: 45 errors from 10 contexts (suppressed: 18 from 1)     
                                                
==14422== malloc/free: in use at exit: 7,356 bytes in 10 blocks.                
                                                
==14422== malloc/free: 187 allocs, 177 frees, 234,711 bytes allocated.          
                                                
==14422== For counts of detected errors, rerun with: -v                         
                                                
==14422== searching for pointers to 10 not-freed blocks.                        
                                                
==14422== checked 6,415,132 bytes.                                              
                                                
==14422==                                                                       
                                                
==14422==                                                                       
                                                
==14422== 24 bytes in 1 blocks are definitely lost in loss record 1 of 3        
                                                
==14422==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)                     
                                                
==14422==    by 0x8048FF7: check_fsmounted(int) (libcgrouptest01.c:1171)        
                                                
==14422==    by 0x804B86B: main (libcgrouptest01.c:168)                         
                                                
==14422==                                                                       
                                                
==14422==                                                                       
                                                
==14422== 2,816 bytes in 8 blocks are still reachable in loss record 2 of 3     
                                                
==14422==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)                     
                                                
==14422==    by 0x4C2AC78E: __fopen_internal (in /lib/libc-2.9.so)              
                                                
==14422==    by 0x4C2AC85B: fopen@@GLIBC_2.1 (in /lib/libc-2.9.so)              
                                                
==14422==    by 0x8049155: get_controllers(char const*, int*) 
(libcgrouptest01.c:979)                                           
==14422==    by 0x804B589: main (libcgrouptest01.c:84)                          
                                                
==14422==                                                                       
                                                
==14422==                                                                       
                                                
==14422== 4,516 bytes in 1 blocks are definitely lost in loss record 3 of 3     
                                                
==14422==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)                     
                                                
==14422==    by 0x4030D9A: cgroup_new_cgroup (wrapper.c:28)                     
                                                
==14422==    by 0x804B056: test_cgroup_get_cgroup(int, int, int) 
(libcgrouptest01.c:1342)                                       
==14422==    by 0x804BC07: main (libcgrouptest01.c:324)                         
                                                
==14422==                                                                       
                                                
==14422== LEAK SUMMARY:                                                         
                                                
==14422==    definitely lost: 4,540 bytes in 2 blocks.                          
                                                
==14422==      possibly lost: 0 bytes in 0 blocks.                              
                                                
==14422==    still reachable: 2,816 bytes in 8 blocks.                          
                                                
==14422==         suppressed: 0 bytes in 0 blocks.                              
                                                
Cleanup done                                                                    
                                                

Running third set of testcases
==============================
==14473== Memcheck, a memory error detector.
==14473== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14473== Using LibVEX rev 1804, a library for dynamic binary translation.
==14473== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.       
==14473== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14473== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.  
==14473== For more details, rerun with: -v                                 
==14473==                                                                  
C:DBG: fs_mounted as recieved from script=2                                
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1       
C:DBG: mountpoint2 as recieved from script=/dev/cgroup_controllers-2       
sanity check pass. cgroup                                                  
TEST 1:PASS : cgroup_init()                      Ret Value = 0             
TEST 2:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0                  
      
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0                  
          
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem
TEST 7:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem
TEST 8:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s    
TEST 9:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s    
TEST10:PASS : cgroup_new_cgroup()                Ret Value = 0                  
          
TEST11:PASS : cgroup_attach_task()               Ret Value = 50002       
Parameter not created group
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0                  
                    
==14473== Conditional jump or move depends on uninitialised value(s)            
                    
==14473==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
                    
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
                    
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804BFB4: main (libcgrouptest01.c:497)                         
                                                
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0                  
                                                
TEST14:PASS : cgroup_new_cgroup()                Ret Value = 0                  
                                                
==14473==                                                                       
                                                
==14473== Conditional jump or move depends on uninitialised value(s)            
                                                
==14473==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
                                                
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
                                                
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804C014: main (libcgrouptest01.c:518)                         
                                                
==14473==                                                                       
                                                
==14473== Conditional jump or move depends on uninitialised value(s)            
                                                
==14473==    at 0x4007285: strcpy (mc_replace_strmem.c:268)                     
                                                
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)                    
                                                
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804C014: main (libcgrouptest01.c:518)                         
                                                
TEST15:PASS : cgroup_modify_cgroup()             Ret Value = 0                  
                                                
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted 
from filesystem                                  
TEST17:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted 
from filesystem
TEST18:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST19:PASS : cgroup_create_cgroup()             Ret Value = 0   group found 
under both controllers
TEST20:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s
TEST21:PASS : cgroup_new_cgroup()                Ret Value = 0
==14473==
==14473== Conditional jump or move depends on uninitialised value(s)
==14473==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804C240: main (libcgrouptest01.c:621)
==14473==
==14473== Conditional jump or move depends on uninitialised value(s)
==14473==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804C240: main (libcgrouptest01.c:621)
TEST22:PASS : cgroup_modify_cgroup()             Ret Value = 0   group modified 
under both controllers
TEST23:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted 
from filesystem
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem
TEST24:FAIL : cgroup_get_cgroup()                Ret Value = 50018
==14473==
==14473== ERROR SUMMARY: 79 errors from 5 contexts (suppressed: 18 from 1)
==14473== malloc/free: in use at exit: 71,348 bytes in 31 blocks.
==14473== malloc/free: 196 allocs, 165 frees, 228,734 bytes allocated.
==14473== For counts of detected errors, rerun with: -v
==14473== searching for pointers to 31 not-freed blocks.
==14473== checked 6,444,900 bytes.
==14473==
==14473==
==14473== 24 bytes in 1 blocks are definitely lost in loss record 1 of 5
==14473==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==14473==    by 0x8048FF7: check_fsmounted(int) (libcgrouptest01.c:1171)
==14473==    by 0x804BD43: main (libcgrouptest01.c:360)
==14473==
==14473==
==14473== 5,280 bytes in 15 blocks are still reachable in loss record 2 of 5
==14473==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==14473==    by 0x4C2AC78E: __fopen_internal (in /lib/libc-2.9.so)
==14473==    by 0x4C2AC85B: fopen@@GLIBC_2.1 (in /lib/libc-2.9.so)
==14473==    by 0x8049155: get_controllers(char const*, int*) 
(libcgrouptest01.c:979)
==14473==    by 0x804B589: main (libcgrouptest01.c:84)
==14473==
==14473==
==14473== 66,044 (18,064 direct, 47,980 indirect) bytes in 4 blocks are 
definitely lost in loss record 3 of 5
==14473==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14473==    by 0x4030D9A: cgroup_new_cgroup (wrapper.c:28)
==14473==    by 0x8049586: new_cgroup(char*, char*, char*, int, int) 
(libcgrouptest01.c:1127)
==14473==    by 0x8049847: create_new_cgroup_ds(int, char const*, int, int) 
(libcgrouptest01.c:743)
==14473==    by 0x804BF74: main (libcgrouptest01.c:484)
==14473==
==14473==
==14473== 20,980 bytes in 5 blocks are indirectly lost in loss record 4 of 5
==14473==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14473==    by 0x4030C2C: cgroup_add_value_string (wrapper.c:122)
==14473==    by 0x8048F3B: _ZL17add_control_valueP17cgroup_controllerPcS1_i 
(libcgrouptest01.c:1108)
==14473==    by 0x80495F9: new_cgroup(char*, char*, char*, int, int) 
(libcgrouptest01.c:1142)
==14473==    by 0x8049847: create_new_cgroup_ds(int, char const*, int, int) 
(libcgrouptest01.c:743)
==14473==    by 0x804BF74: main (libcgrouptest01.c:484)
==14473==
==14473==
==14473== 27,000 bytes in 6 blocks are indirectly lost in loss record 5 of 5
==14473==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14473==    by 0x4030F4B: cgroup_add_controller (wrapper.c:62)
==14473==    by 0x80495DE: new_cgroup(char*, char*, char*, int, int) 
(libcgrouptest01.c:1139)
==14473==    by 0x8049847: create_new_cgroup_ds(int, char const*, int, int) 
(libcgrouptest01.c:743)
==14473==    by 0x804BF74: main (libcgrouptest01.c:484)
==14473==
==14473== LEAK SUMMARY:
==14473==    definitely lost: 18,088 bytes in 5 blocks.
==14473==    indirectly lost: 47,980 bytes in 11 blocks.
==14473==      possibly lost: 0 bytes in 0 blocks.
==14473==    still reachable: 5,280 bytes in 15 blocks.
==14473==         suppressed: 0 bytes in 0 blocks.
Cleanup done

The cgroup_modify_cgroup uninitialized error is fixed in the clean up
patches.

After this patch, there are no leaks in the library as per the test
cases and valgrind. (The cgroup data structure has to be explictly
freed by the caller, so it is not a leak in the library)

Signed-off-by: Dhaval Giani <[email protected]>
---
 api.c |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Index: trunk/api.c
===================================================================
--- trunk.orig/api.c    2009-01-04 22:18:44.000000000 +0530
+++ trunk/api.c 2009-01-04 22:22:19.000000000 +0530
@@ -562,11 +562,17 @@ int cgroup_init()
         *
         * XX: fix the size for fgets
         */
-       buf = fgets(subsys_name, FILENAME_MAX, proc_cgroup);
+       buf = malloc(FILENAME_MAX);
+       if (!buf) {
+               ret = ECGOTHER;
+               goto unlock_exit;
+       }
+       buf = fgets(buf, FILENAME_MAX, proc_cgroup);
        if (!buf) {
                ret = EIO;
                goto unlock_exit;
        }
+       free(buf);
 
        while (!feof(proc_cgroup)) {
                err = fscanf(proc_cgroup, "%s %d %d %d", subsys_name,
@@ -578,7 +584,6 @@ int cgroup_init()
                i++;
        }
        controllers[i] = NULL;
-       fclose(proc_cgroup);
 
        proc_mount = fopen("/proc/mounts", "r");
        if (proc_mount == NULL) {
@@ -632,10 +637,18 @@ int cgroup_init()
        found_mnt++;
        cg_mount_table[found_mnt].name[0] = '\0';
 
-       fclose(proc_mount);
        cgroup_initialized = 1;
 
 unlock_exit:
+       if (proc_cgroup)
+               fclose(proc_cgroup);
+
+       if (proc_mount)
+               fclose(proc_mount);
+
+       for (i = 0; controllers[i]; i++)
+               free(controllers[i]);
+
        pthread_rwlock_unlock(&cg_mount_table_lock);
        return ret;
 }
@@ -847,6 +860,7 @@ static int cg_mkdir_p(const char *path)
        char cwd[FILENAME_MAX], *buf;
 
        buf = getcwd(cwd, FILENAME_MAX);
+
        if (!buf)
                return ECGOTHER;
 



------------------------------------------------------------------------------
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to