Skip to content

Commit

Permalink
Al parecer modificar un char * = "" es undefined behaviour...
Browse files Browse the repository at this point in the history
  • Loading branch information
rdvdev2 committed Dec 13, 2023
1 parent 9f6f17d commit 2a24593
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions user.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void bucle_infinito(void *n) {

void print_stats() {
int pid = getpid();
struct stats my_stats = {};
struct stats my_stats;
if (get_stats(pid, &my_stats) < 0) {
perror();
return;
Expand All @@ -53,10 +53,10 @@ void print_stats() {
}

void echo() {
char *buff = "";
char buff;
for (;;) {
if (waitKey(buff, 300) == 0) {
write(1, buff, 1);
if (waitKey(&buff, 300) == 0) {
write(1, &buff, 1);
print_stats();
} else
perror();
Expand Down

0 comments on commit 2a24593

Please sign in to comment.