Skip to content

Bug in finding swap file - strcmp#5

Open
ishaansehgal99 wants to merge 2 commits intomainfrom
dev/t-isehgal/str-cmp-bug
Open

Bug in finding swap file - strcmp#5
ishaansehgal99 wants to merge 2 commits intomainfrom
dev/t-isehgal/str-cmp-bug

Conversation

@ishaansehgal99
Copy link
Copy Markdown
Contributor

@ishaansehgal99 ishaansehgal99 commented Jun 28, 2022

This PR can be used as conversation. I have a concern with find swap file function. Previously the !strcmp(type, "file") would never evaluate to true, because type is a non null-terminated field from the /proc/swaps file. The type string would include total size, used size, and priority in the same line.

Correcting this line to strncmp, raised other concerns, however:

  1. While the size stored in /proc/swaps on my machine is in kb will this be true on all machines
  2. Is this method more reliable/preferred then the backup method which simply checks stat size on /hiberfile.sys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant