Blame sysdeps/openbsd/glibtop_private.c
|
Packit Service |
407539 |
#include <config.h>
|
|
Packit Service |
407539 |
#include <glibtop.h>
|
|
Packit Service |
407539 |
#include <glibtop/error.h>
|
|
Packit Service |
407539 |
|
|
Packit Service |
407539 |
#include "glibtop_private.h"
|
|
Packit Service |
407539 |
|
|
Packit Service |
407539 |
#include <sys/types.h>
|
|
Packit Service |
407539 |
#include <unistd.h>
|
|
Packit Service |
407539 |
#include <string.h>
|
|
Packit Service |
407539 |
#include <glib.h>
|
|
Packit Service |
407539 |
#include <errno.h>
|
|
Packit Service |
407539 |
|
|
Packit Service |
407539 |
/* Ported from linux/glibtop_private.c */
|
|
Packit Service |
407539 |
gboolean
|
|
Packit Service |
407539 |
safe_readlink(const char *path, char *buf, int bufsiz)
|
|
Packit Service |
407539 |
{
|
|
Packit Service |
407539 |
int ret;
|
|
Packit Service |
407539 |
|
|
Packit Service |
407539 |
ret = readlink(path, buf, bufsiz - 1);
|
|
Packit Service |
407539 |
|
|
Packit Service |
407539 |
if (ret == -1) {
|
|
Packit Service |
407539 |
g_warning("Could not read link %s : %s", path, strerror(errno));
|
|
Packit Service |
407539 |
return FALSE;
|
|
Packit Service |
407539 |
}
|
|
Packit Service |
407539 |
|
|
Packit Service |
407539 |
buf[ret] = '\0';
|
|
Packit Service |
407539 |
return TRUE;
|
|
Packit Service |
407539 |
}
|