Skip to content

Commit

Permalink
fixed a bug that caused to show 0% memory
Browse files Browse the repository at this point in the history
  • Loading branch information
alba4k committed Mar 7, 2022
1 parent 49d0beb commit 53b9aac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/albafetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <sys/wait.h>
#include <sys/sysinfo.h>
#include <limits.h> // used to get max hostname lenght
#include <stdint.h>

#include "config.h"

Expand Down Expand Up @@ -159,9 +160,9 @@ int main() {

len = read(pipes[0], used_str, 14);
used_str[len - 1] = 0;
const unsigned int used = atoi(used_str);
uint64_t used = atol(used_str);

printf("%i MiB / %lu MiB (%lu%%)\n", used/1048576, total/1048576, (used * 100) / (total*1048576));
printf("%ld MiB / %lu MiB (%ld%%)\n", used/1048576, total/1048576, (used * 100) / total);

// ******** remaining lines of the logo ********

Expand Down

0 comments on commit 53b9aac

Please sign in to comment.