Revert "added the Uzbek language я исправил потвердите (#3306)"

This reverts commit d3b911d249.
This commit is contained in:
longpanda
2025-12-21 20:33:25 +08:00
parent f6c248e983
commit f68d4a8076
9 changed files with 66 additions and 177 deletions

View File

@@ -7963,32 +7963,28 @@ delete_file(struct mg_connection *conn, const char *path)
}
/* This is an existing file (not a directory).
* Try to delete it directly and handle errors. */
* Check if write permission is granted. */
if (access(path, W_OK) != 0) {
/* File is read only */
send_http_error(
conn,
403,
"Error: Delete not possible\nDeleting %s is not allowed",
path);
return;
}
/* Try to delete it. */
if (mg_remove(conn, path) == 0) {
/* Delete was successful: Return 204 without content. */
send_http_error(conn, 204, "%s", "");
} else {
/* Check the reason for failure. */
if (ERRNO == EACCES || ERRNO == EPERM) {
send_http_error(
conn,
403,
"Error: Delete not possible\nDeleting %s is not allowed",
path);
} else if (ERRNO == EBUSY || ERRNO == EAGAIN) {
send_http_error(conn,
423,
"Error: Cannot delete file\nremove(%s): %s",
path,
strerror(ERRNO));
} else {
send_http_error(conn,
500,
"Error: Could not delete %s\nremove(%s): %s",
path,
path,
strerror(ERRNO));
}
/* Delete not successful (file locked). */
send_http_error(conn,
423,
"Error: Cannot delete file\nremove(%s): %s",
path,
strerror(ERRNO));
}
}
#endif /* !NO_FILES */

View File

@@ -1,8 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
@@ -1194,34 +1192,26 @@ static int detect_gui_exe_path(int argc, char **argv, const char *curpath, char
vlog("This is %s%d X environment.\n", guitype, ver);
vlog("exe = %s\n", pathbuf);
int fd = open(pathbuf, O_RDONLY);
if (fd == -1)
if (access(pathbuf, F_OK) == -1)
{
vlog("%s does not exist or cannot be opened.\n", pathbuf);
vlog("%s is not exist.\n", pathbuf);
return 1;
}
if (fstat(fd, &filestat) == 0)
if (access(pathbuf, X_OK) == -1)
{
if ((filestat.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0)
vlog("execute permission check fail, try chmod.\n", pathbuf);
if (stat(pathbuf, &filestat) == 0)
{
vlog("execute permission check fail, try chmod.\n");
mode = filestat.st_mode | S_IXUSR | S_IXGRP | S_IXOTH;
ret = fchmod(fd, mode);
ret = chmod(pathbuf, mode);
vlog("old mode=%o new mode=%o ret=%d\n", filestat.st_mode, mode, ret);
}
else
{
vlog("execute permission check success.\n");
}
}
else
{
vlog("fstat failed on %s\n", pathbuf);
close(fd);
return 1;
vlog("execute permission check success.\n");
}
close(fd);
return 0;
}