Rizin
unix-like reverse engineering framework and cli tools
procfs-exepath.c File Reference
#include "uv.h"
#include "internal.h"
#include <stddef.h>
#include <unistd.h>

Go to the source code of this file.

Functions

int uv_exepath (char *buffer, size_t *size)
 

Function Documentation

◆ uv_exepath()

int uv_exepath ( char *  buffer,
size_t size 
)

Definition at line 28 of file procfs-exepath.c.

28  {
29  ssize_t n;
30 
31  if (buffer == NULL || size == NULL || *size == 0)
32  return UV_EINVAL;
33 
34  n = *size - 1;
35  if (n > 0)
36  n = readlink("/proc/self/exe", buffer, n);
37 
38  if (n == -1)
39  return UV__ERR(errno);
40 
41  buffer[n] = '\0';
42  *size = n;
43 
44  return 0;
45 }
#define NULL
Definition: cris-opc.c:27
static static sync static getppid static getegid const char static filename char static len readlink
Definition: sflib.h:65
#define UV__ERR(x)
Definition: errno.h:29
voidpf void uLong size
Definition: ioapi.h:138
int n
Definition: mipsasm.c:19
int ssize_t
Definition: sftypes.h:39
Definition: buffer.h:15

References n, NULL, readlink, and UV__ERR.