summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dged/buffer.c4
-rw-r--r--src/main/main.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/dged/buffer.c b/src/dged/buffer.c
index 3259534..6337096 100644
--- a/src/dged/buffer.c
+++ b/src/dged/buffer.c
@@ -440,6 +440,8 @@ void buffer_to_file(struct buffer *buffer) {
minibuffer_echo_timeout(4, "wrote %d lines to %s", nlines_to_write,
buffer->filename);
fclose(file);
+ struct stat sb;
+ stat(buffer->filename, &sb);
if (rename(backupname, fullname) == -1) {
minibuffer_echo("failed to rename backup \"%s\" to \"%s\": %s", backupname,
fullname, strerror(errno));
@@ -447,6 +449,7 @@ void buffer_to_file(struct buffer *buffer) {
free(backupname);
return;
}
+ chmod(buffer->filename, sb.st_mode);
free(fullname);
free(backupname);
@@ -454,7 +457,6 @@ void buffer_to_file(struct buffer *buffer) {
buffer->modified = false;
undo_push_boundary(&buffer->undo, (struct undo_boundary){.save_point = true});
- struct stat sb;
stat(buffer->filename, &sb);
buffer->last_write = sb.st_mtim;
diff --git a/src/main/main.c b/src/main/main.c
index 70c62a3..e9f7938 100644
--- a/src/main/main.c
+++ b/src/main/main.c
@@ -39,6 +39,7 @@
#include "cmds.h"
#include "completion.h"
#include "frame-hooks.h"
+#include "revision.h"
#include "version.h"
/* welcome.h is generated from welcome.inc with
@@ -169,7 +170,7 @@ static void usage(void) {
}
static void version(void) {
- printf("dged - %s\n© Albert Cervin 2024\n", DGED_VERSION);
+ printf("dged - %s (%s)\n© Albert Cervin 2025\n", DGED_VERSION, DGED_REVISION);
}
int main(int argc, char *argv[]) {