fix extension not removed from basename

This commit is contained in:
Night Kaly 2024-04-10 17:05:06 +01:00
parent f418fec045
commit 66bb56ad19
Signed by: night0721
GPG key ID: 957D67B8DB7A119B

View file

@ -382,7 +382,12 @@ int main(int argc, char *argv[])
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
char *content = memalloc(file_size * sizeof(char)); char *content = memalloc(file_size * sizeof(char));
fread(content, sizeof(char), file_size, file); fread(content, sizeof(char), file_size, file);
encrypt_password(basename(filename), content); char *f_basename = basename(filename);
char *dot = strrchr(f_basename, '.');
if (dot != NULL) {
*dot = '\0';
}
encrypt_password(f_basename, content);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
case 'G':; case 'G':;