/[path-sandbox]/trunk/canonicalize.c
Gentoo

Diff of /trunk/canonicalize.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 25 Revision 29
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <errno.h> 30#include <errno.h>
31#include <stddef.h> 31#include <stddef.h>
32 32
33#include "config.h" 33#include "config.h"
34#include "sb_path_max.h" 34#include "localdecls.h"
35 35
36#ifndef __set_errno 36#ifndef __set_errno
37# define __set_errno(val) errno = (val) 37# define __set_errno(val) errno = (val)
38#endif 38#endif
39 39
161 if (dest > rpath + 1 && dest[-1] == '/') 161 if (dest > rpath + 1 && dest[-1] == '/')
162 --dest; 162 --dest;
163#endif 163#endif
164 *dest = '\0'; 164 *dest = '\0';
165 165
166 return resolved ? memcpy(resolved, rpath, dest - rpath + 1) : rpath; 166 return resolved ? rpath : memcpy(resolved, rpath, dest - rpath + 1);
167 167
168error: 168error:
169 if (resolved) 169 if (resolved)
170 strcpy(resolved, rpath); 170 strncpy(resolved, rpath, path_max - 1);
171 else 171 else
172 free(rpath); 172 free(rpath);
173 return NULL; 173 return NULL;
174} 174}
175 175
176// vim:expandtab noai:cindent ai 176// vim:noexpandtab noai:cindent ai

Legend:
Removed from v.25  
changed lines
  Added in v.29

  ViewVC Help
Powered by ViewVC 1.1.20