Explorar o código

fix signed overflow in ftok

Daniel Sabogal %!s(int64=7) %!d(string=hai) anos
pai
achega
511b7042b3
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/ipc/ftok.c

+ 1 - 1
src/ipc/ftok.c

@@ -6,5 +6,5 @@ key_t ftok(const char *path, int id)
 	struct stat st;
 	if (stat(path, &st) < 0) return -1;
 
-	return ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) | ((id & 0xff) << 24));
+	return ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) | ((id & 0xffu) << 24));
 }